/*
 NAVICAT PREMIUM DUMP SQL

 SOURCE SERVER         : GAUSSDB
 SOURCE SERVER TYPE    : POSTGRESQL
 SOURCE SERVER VERSION : 90204 (90204)
 SOURCE HOST           : 172.16.49.35:5432
 SOURCE CATALOG        : POSTGRES
 SOURCE SCHEMA         : KNOWLEDGE

 TARGET SERVER TYPE    : POSTGRESQL
 TARGET SERVER VERSION : 90204 (90204)
 FILE ENCODING         : 65001

 DATE: 12/11/2025 15:39:39
*/


-- ----------------------------
-- TABLE STRUCTURE FOR AGENT_DATASETS_OPERATION_LOG
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."AGENT_DATASETS_OPERATION_LOG";
CREATE TABLE "KNOWLEDGE"."AGENT_DATASETS_OPERATION_LOG" (
  "ID" INT8 NOT NULL,
  "DATASET_ID" INT8,
  "FILE_ID" INT8,
  "CHUNK_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "OPERATION_TYPE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "CREATED_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "CREATED_ID" INT8,
  "UPDATE_ID" INT8,
  "CREATED_USER_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_USER_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_DATASETS_OPERATION_LOG"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_DATASETS_OPERATION_LOG"."DATASET_ID" IS '知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_DATASETS_OPERATION_LOG"."FILE_ID" IS '文件ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_DATASETS_OPERATION_LOG"."CHUNK_ID" IS '切⽚ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_DATASETS_OPERATION_LOG"."OPERATION_TYPE" IS '操作⾏为';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_DATASETS_OPERATION_LOG"."CREATED_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_DATASETS_OPERATION_LOG"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_DATASETS_OPERATION_LOG"."CREATED_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_DATASETS_OPERATION_LOG"."UPDATE_ID" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_DATASETS_OPERATION_LOG"."CREATED_USER_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_DATASETS_OPERATION_LOG"."UPDATE_USER_NAME" IS '更新人名称';
COMMENT ON TABLE "KNOWLEDGE"."AGENT_DATASETS_OPERATION_LOG" IS '知识库操作记录表';

-- ----------------------------
-- TABLE STRUCTURE FOR AGENT_TEAM_INVITE_CODE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."AGENT_TEAM_INVITE_CODE";
CREATE TABLE "KNOWLEDGE"."AGENT_TEAM_INVITE_CODE" (
  "ID" INT8 NOT NULL,
  "AGENT_TEAM_ID" INT8 NOT NULL,
  "CODE" VARCHAR(1024) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DAY" INT4,
  "EXPIRE_TIME" TIMESTAMP(6),
  "STATUS" INT4 NOT NULL
)
;
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_INVITE_CODE"."AGENT_TEAM_ID" IS '智能体平台团队';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_INVITE_CODE"."CODE" IS '团队邀请码';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_INVITE_CODE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_INVITE_CODE"."UPDATE_TIME" IS '修改时间';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_INVITE_CODE"."DAY" IS '有效天数';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_INVITE_CODE"."EXPIRE_TIME" IS '失效时间';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_INVITE_CODE"."STATUS" IS '是否有效，1有效 0失效';
COMMENT ON TABLE "KNOWLEDGE"."AGENT_TEAM_INVITE_CODE" IS '智能体平台团队邀请码表';

-- ----------------------------
-- TABLE STRUCTURE FOR AGENT_TEAM_MEMBERS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."AGENT_TEAM_MEMBERS";
CREATE TABLE "KNOWLEDGE"."AGENT_TEAM_MEMBERS" (
  "ID" INT8 NOT NULL,
  "USER_ID" INT8 NOT NULL,
  "TEAM_ID" INT8 NOT NULL,
  "DEFAULT_TEAM" BOOL,
  "NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ROLE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "STATUS" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "USER_ACCOUNT" VARCHAR COLLATE "PG_CATALOG"."DEFAULT",
  "AI_JURISDICTION" VARCHAR COLLATE "PG_CATALOG"."DEFAULT",
  "REPOSITORY_JURISDICTION" VARCHAR COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_JURISDICTION" VARCHAR COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_MEMBERS"."ID" IS '主键标识';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_MEMBERS"."USER_ID" IS '用户ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_MEMBERS"."TEAM_ID" IS '团队ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_MEMBERS"."DEFAULT_TEAM" IS '是否默认团队';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_MEMBERS"."NAME" IS '名称';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_MEMBERS"."ROLE" IS '角色';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_MEMBERS"."STATUS" IS '状态：ACTIVE INACTIVE';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_MEMBERS"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_MEMBERS"."USER_ACCOUNT" IS '用户账号';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_MEMBERS"."AI_JURISDICTION" IS '智能体权限(1.可查看 2.可编辑(查询,编辑,新增))';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_MEMBERS"."REPOSITORY_JURISDICTION" IS '知识库权限(1.可查看 2.可编辑(查询，编辑，新增)3.可下载(查询，编辑，新增，下载))';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_MEMBERS"."PLUGIN_JURISDICTION" IS '插件权限(1.可查看2.可编辑(查询，编辑，新增))';
COMMENT ON TABLE "KNOWLEDGE"."AGENT_TEAM_MEMBERS" IS '团队成员表';

-- ----------------------------
-- TABLE STRUCTURE FOR AGENT_TEAM_USER_LOG
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."AGENT_TEAM_USER_LOG";
CREATE TABLE "KNOWLEDGE"."AGENT_TEAM_USER_LOG" (
  "ID" INT8 NOT NULL,
  "FUNCTION_POINT" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "OPERATION_TYPE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PRIMARY_FUNCTIONALITIES" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TEAM_ID" INT8,
  "CREATED_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "CREATED_ID" INT8,
  "UPDATE_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_USER_LOG"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_USER_LOG"."FUNCTION_POINT" IS '功能点';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_USER_LOG"."OPERATION_TYPE" IS '操作类型';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_USER_LOG"."PRIMARY_FUNCTIONALITIES" IS '主功能点';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_USER_LOG"."TEAM_ID" IS '团队空间ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_USER_LOG"."CREATED_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_USER_LOG"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_USER_LOG"."CREATED_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAM_USER_LOG"."UPDATE_ID" IS '更新人';
COMMENT ON TABLE "KNOWLEDGE"."AGENT_TEAM_USER_LOG" IS '团队空间人员操作记录表';

-- ----------------------------
-- TABLE STRUCTURE FOR AGENT_TEAMS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."AGENT_TEAMS";
CREATE TABLE "KNOWLEDGE"."AGENT_TEAMS" (
  "ID" INT8 NOT NULL,
  "NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "IMAGE" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "CREATE_USER" INT8,
  "STATUS" INT4 DEFAULT 1,
  "TEAM_TYPE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT 2,
  "TEAM_DESC" VARCHAR(2048) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAMS"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAMS"."NAME" IS '团队名称';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAMS"."IMAGE" IS '团队头像';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAMS"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAMS"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAMS"."CREATE_USER" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAMS"."STATUS" IS '是否开启邀请加入团队，1是 0否';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAMS"."TEAM_TYPE" IS '团队空间类型(1.部门类型2.项目类型)';
COMMENT ON COLUMN "KNOWLEDGE"."AGENT_TEAMS"."TEAM_DESC" IS '团队空间描述';

-- ----------------------------
-- TABLE STRUCTURE FOR AGT_APP_DIR
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."AGT_APP_DIR";
CREATE TABLE "KNOWLEDGE"."AGT_APP_DIR" (
  "DIR_ID" INT8 NOT NULL,
  "KIND_ID" INT8,
  "DIR_CODE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "DIR_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "DIR_TYPE" INT4,
  "PARENT_DIR_ID" INT8,
  "PATH_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_BY" INT8,
  "UPDATE_BY" INT8,
  "CREATE_DATE" TIMESTAMP(6),
  "UPDATE_DATE" TIMESTAMP(6),
  "COM_ACCT_ID" INT8,
  "PROJECT_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_DIR"."DIR_ID" IS '主键标识';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_DIR"."KIND_ID" IS '分类标识';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_DIR"."DIR_CODE" IS '目录编码';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_DIR"."DIR_NAME" IS '目录名称';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_DIR"."DIR_TYPE" IS '目录类型:1：插件&智能体  2：知识库';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_DIR"."PARENT_DIR_ID" IS '父级目录';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_DIR"."PATH_CODE" IS '目录路径';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_DIR"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_DIR"."UPDATE_BY" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_DIR"."CREATE_DATE" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_DIR"."UPDATE_DATE" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_DIR"."COM_ACCT_ID" IS '所属企业';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_DIR"."PROJECT_ID" IS '所属项目';
COMMENT ON TABLE "KNOWLEDGE"."AGT_APP_DIR" IS '目录表';

-- ----------------------------
-- TABLE STRUCTURE FOR AGT_APP_DIR_KIND
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."AGT_APP_DIR_KIND";
CREATE TABLE "KNOWLEDGE"."AGT_APP_DIR_KIND" (
  "KIND_ID" INT8 NOT NULL,
  "KIND_CODE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "KIND_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TYPE" INT4,
  "CREATE_BY" INT8,
  "COM_ACCT_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_DIR_KIND"."KIND_ID" IS '主键标识';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_DIR_KIND"."KIND_CODE" IS '分类编码';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_DIR_KIND"."KIND_NAME" IS '分类名称';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_DIR_KIND"."TYPE" IS '类型 1：项目管理，2：应用开放';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_DIR_KIND"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_DIR_KIND"."COM_ACCT_ID" IS '所属企业';
COMMENT ON TABLE "KNOWLEDGE"."AGT_APP_DIR_KIND" IS '分类表:用于目录分类';

-- ----------------------------
-- TABLE STRUCTURE FOR AGT_APP_PARAM
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."AGT_APP_PARAM";
CREATE TABLE "KNOWLEDGE"."AGT_APP_PARAM" (
  "APP_PARAM_ID" INT8 NOT NULL,
  "APP_PARAM_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "RULE_TYPE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "RULE_EXP" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "PARAM_SAMPLE" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_BY" INT8,
  "CREATE_DATE" TIMESTAMP(6),
  "UPDATE_BY" INT8,
  "UPDATE_DATE" TIMESTAMP(6),
  "COM_ACCT_ID" INT8,
  "PROJECT_ID" INT8,
  "REL_APP_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_PARAM"."APP_PARAM_ID" IS '关联参数标识';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_PARAM"."APP_PARAM_NAME" IS '关键信息名称';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_PARAM"."RULE_TYPE" IS '关键信息类型:EMAIL,IDCARD,PHONE';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_PARAM"."RULE_EXP" IS '表达式';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_PARAM"."PARAM_SAMPLE" IS '样例';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_PARAM"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_PARAM"."CREATE_DATE" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_PARAM"."UPDATE_BY" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_PARAM"."UPDATE_DATE" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_PARAM"."COM_ACCT_ID" IS '所属企业';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_PARAM"."PROJECT_ID" IS '项目ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_PARAM"."REL_APP_ID" IS '智能体ID';
COMMENT ON TABLE "KNOWLEDGE"."AGT_APP_PARAM" IS '智能体关键参数表';

-- ----------------------------
-- TABLE STRUCTURE FOR AGT_APP_REL_AGENT
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."AGT_APP_REL_AGENT";
CREATE TABLE "KNOWLEDGE"."AGT_APP_REL_AGENT" (
  "APP_REL_AGENT_ID" INT8 NOT NULL,
  "APP_TYPE" INT4,
  "CREATE_BY" INT8,
  "UPDATE_BY" INT8,
  "UPDATE_DATE" TIMESTAMP(6),
  "COM_ACCT_ID" INT8,
  "REL_APP_ID" INT8,
  "APP_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_REL_AGENT"."APP_REL_AGENT_ID" IS '主键标识';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_REL_AGENT"."APP_TYPE" IS '关联类型:1：智能体，2：智能体集合';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_REL_AGENT"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_REL_AGENT"."UPDATE_BY" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_REL_AGENT"."UPDATE_DATE" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_REL_AGENT"."COM_ACCT_ID" IS '所属企业';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_REL_AGENT"."REL_APP_ID" IS '关联智能体ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_APP_REL_AGENT"."APP_ID" IS '智能体ID';
COMMENT ON TABLE "KNOWLEDGE"."AGT_APP_REL_AGENT" IS '智能体关联表';

-- ----------------------------
-- TABLE STRUCTURE FOR AGT_DECISION_INFO
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."AGT_DECISION_INFO";
CREATE TABLE "KNOWLEDGE"."AGT_DECISION_INFO" (
  "DECISION_ID" INT8 NOT NULL,
  "APP_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "CHAT_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "USER_QUESTION" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "DECISION_TIME" TIMESTAMP(6),
  "DECISION_RESULT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" INT8,
  "ABILITY_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CHAT_ITEM_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "START_TIME" INT8,
  "END_TIME" INT8,
  "TYPE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TIME" INT8,
  "DECISION_IN_PARAM" TEXT COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."AGT_DECISION_INFO"."DECISION_ID" IS '识别ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_DECISION_INFO"."APP_ID" IS '智能体ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_DECISION_INFO"."CHAT_ID" IS '聊天会话ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_DECISION_INFO"."USER_QUESTION" IS '用户问题';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_DECISION_INFO"."DECISION_TIME" IS '识别时间';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_DECISION_INFO"."DECISION_RESULT" IS '识别结果';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_DECISION_INFO"."CREATE_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_DECISION_INFO"."ABILITY_NAME" IS '技能名称';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_DECISION_INFO"."CHAT_ITEM_ID" IS '会话ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_DECISION_INFO"."START_TIME" IS '开始时间';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_DECISION_INFO"."END_TIME" IS '结束时间';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_DECISION_INFO"."TYPE" IS '类型';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_DECISION_INFO"."TIME" IS '耗时';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_DECISION_INFO"."DECISION_IN_PARAM" IS '入参';

-- ----------------------------
-- TABLE STRUCTURE FOR AGT_FEEDBACK_INFO
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."AGT_FEEDBACK_INFO";
CREATE TABLE "KNOWLEDGE"."AGT_FEEDBACK_INFO" (
  "APP_ID" INT8 NOT NULL,
  "CHAT_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "CHAT_ITEM_ID" INT8 NOT NULL,
  "FEEDBACK_STATE" INT4 NOT NULL,
  "FEEDBACK_MARK_CODE" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "FEEDBACK_OTHER_DESC" VARCHAR(1024) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."AGT_FEEDBACK_INFO"."APP_ID" IS '智能体ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_FEEDBACK_INFO"."CHAT_ID" IS '会话标识';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_FEEDBACK_INFO"."CHAT_ITEM_ID" IS '会话聊天ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_FEEDBACK_INFO"."FEEDBACK_STATE" IS '赞踩标识：1 赞， 2 踩';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_FEEDBACK_INFO"."FEEDBACK_MARK_CODE" IS '赞踩标识编码';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_FEEDBACK_INFO"."FEEDBACK_OTHER_DESC" IS '其他描述信息';

-- ----------------------------
-- TABLE STRUCTURE FOR AGT_MODEL_GROUP_INFO
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."AGT_MODEL_GROUP_INFO";
CREATE TABLE "KNOWLEDGE"."AGT_MODEL_GROUP_INFO" (
  "GROUP_ID" INT8 NOT NULL,
  "GROUP_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "GROUP_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "GROUP_DESC" VARCHAR(2000) COLLATE "PG_CATALOG"."DEFAULT",
  "GROUP_STATE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_BY" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_BY" INT8,
  "UPDATE_TIME" TIMESTAMP(6)
)
;
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_GROUP_INFO"."GROUP_ID" IS '分组ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_GROUP_INFO"."GROUP_NAME" IS '分组名称';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_GROUP_INFO"."GROUP_CODE" IS '分组编码';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_GROUP_INFO"."GROUP_DESC" IS '分组描述';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_GROUP_INFO"."GROUP_STATE" IS '状态。001-可用；002-不可用';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_GROUP_INFO"."CREATE_BY" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_GROUP_INFO"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_GROUP_INFO"."UPDATE_BY" IS '修改人';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_GROUP_INFO"."UPDATE_TIME" IS '修改时间';

-- ----------------------------
-- TABLE STRUCTURE FOR AGT_MODEL_GROUP_REL
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."AGT_MODEL_GROUP_REL";
CREATE TABLE "KNOWLEDGE"."AGT_MODEL_GROUP_REL" (
  "REL_ID" INT8 NOT NULL,
  "GROUP_ID" INT8,
  "AI_MODEL_ID" INT8,
  "REL_STATE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_BY" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_BY" INT8,
  "UPDATE_TIME" TIMESTAMP(6)
)
;
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_GROUP_REL"."REL_ID" IS '关系主键';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_GROUP_REL"."GROUP_ID" IS '分组ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_GROUP_REL"."AI_MODEL_ID" IS '大模型ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_GROUP_REL"."REL_STATE" IS '状态。001-生效；002-失效';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_GROUP_REL"."CREATE_BY" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_GROUP_REL"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_GROUP_REL"."UPDATE_BY" IS '修改人';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_GROUP_REL"."UPDATE_TIME" IS '修改时间';

-- ----------------------------
-- TABLE STRUCTURE FOR AGT_MODEL_LOAD
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."AGT_MODEL_LOAD";
CREATE TABLE "KNOWLEDGE"."AGT_MODEL_LOAD" (
  "MODEL_ID" INT8 NOT NULL,
  "CURRENT_LOAD" INT4 DEFAULT 0,
  "GPU_RATE" INT4 NOT NULL DEFAULT 0,
  "G_MEM_RATE" INT4 NOT NULL DEFAULT 0,
  "CPU_RATE" INT4 NOT NULL DEFAULT 0,
  "MEM_RATE" INT4 NOT NULL DEFAULT 0,
  "NET_RATE" INT4 NOT NULL DEFAULT 0,
  "IO_RATE" INT4 NOT NULL DEFAULT 0,
  "FACTOR1" INT4 NOT NULL DEFAULT 0,
  "FACTOR2" INT4 NOT NULL DEFAULT 0
)
;
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_LOAD"."MODEL_ID" IS '模型ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_LOAD"."CURRENT_LOAD" IS '当前负载';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_LOAD"."FACTOR1" IS '其他影响因子1使用率';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_LOAD"."FACTOR2" IS '其他影响因子2使用率';

-- ----------------------------
-- TABLE STRUCTURE FOR AGT_MODEL_RECORD
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."AGT_MODEL_RECORD";
CREATE TABLE "KNOWLEDGE"."AGT_MODEL_RECORD" (
  "USE_ID" INT8 NOT NULL,
  "MODEL_ID" INT8,
  "GROUP_ID" INT8,
  "START_TIME" TIMESTAMP(6),
  "CURRENT_LOAD" INT4 DEFAULT 0,
  "END_TIME" TIMESTAMP(6),
  "END_STATUS" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "USE_BY" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_RECORD"."USE_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_RECORD"."MODEL_ID" IS '模型ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_RECORD"."GROUP_ID" IS '分组ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_RECORD"."START_TIME" IS '开始时间';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_RECORD"."CURRENT_LOAD" IS '当前负载';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_RECORD"."END_TIME" IS '结束时间';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_RECORD"."END_STATUS" IS '结束状态。001-正常结束；002-报错结束';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_MODEL_RECORD"."USE_BY" IS '使用者ID';

-- ----------------------------
-- TABLE STRUCTURE FOR AGT_PLUGIN_APP_SOURCE_INFO
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."AGT_PLUGIN_APP_SOURCE_INFO";
CREATE TABLE "KNOWLEDGE"."AGT_PLUGIN_APP_SOURCE_INFO" (
  "SOURCE_ID" INT8 NOT NULL,
  "PLUGIN_NAME" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_CODE" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_DESC" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "IN_PARAM" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "OUT_PARAM" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "PROJECT_ID" INT8,
  "COM_ACCT_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."AGT_PLUGIN_APP_SOURCE_INFO"."SOURCE_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_PLUGIN_APP_SOURCE_INFO"."PLUGIN_NAME" IS '名称';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_PLUGIN_APP_SOURCE_INFO"."PLUGIN_CODE" IS '编码';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_PLUGIN_APP_SOURCE_INFO"."PLUGIN_DESC" IS '描述';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_PLUGIN_APP_SOURCE_INFO"."IN_PARAM" IS '入参';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_PLUGIN_APP_SOURCE_INFO"."OUT_PARAM" IS '出参';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_PLUGIN_APP_SOURCE_INFO"."PROJECT_ID" IS '项目ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_PLUGIN_APP_SOURCE_INFO"."COM_ACCT_ID" IS '企业ID';
COMMENT ON TABLE "KNOWLEDGE"."AGT_PLUGIN_APP_SOURCE_INFO" IS '插件来源API表';

-- ----------------------------
-- TABLE STRUCTURE FOR AGT_SCRIPT_INFO
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."AGT_SCRIPT_INFO";
CREATE TABLE "KNOWLEDGE"."AGT_SCRIPT_INFO" (
  "SCRIPT_ID" VARCHAR COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "CODE_TYPE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "REL_PK_ID" VARCHAR COLLATE "PG_CATALOG"."DEFAULT",
  "SCRIPT_KIND" INT4,
  "PROJECT_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PROJECT_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PROJECT_URL" VARCHAR COLLATE "PG_CATALOG"."DEFAULT",
  "SCRIPT_INFO" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "SCRIPT_INFO_IMG" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "VERSION" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_BY" INT8,
  "CREATE_DATE" TIMESTAMP(6),
  "PROJECT_ID" INT8,
  "COM_ACCT_ID" INT8,
  "SCRIPT_LANGUAGE" VARCHAR COLLATE "PG_CATALOG"."DEFAULT",
  "SCRIPT_FRAME" VARCHAR COLLATE "PG_CATALOG"."DEFAULT",
  "IS_LOCK" CHAR(1) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT '0'::BPCHAR,
  "RUNNING_STATUS" INT4 DEFAULT 0,
  "VERSION_RELEASE" INT4 DEFAULT 1
)
;
COMMENT ON COLUMN "KNOWLEDGE"."AGT_SCRIPT_INFO"."IS_LOCK" IS '锁状态：1:锁，0：未锁';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_SCRIPT_INFO"."RUNNING_STATUS" IS '运行状态，1 成功 0 失败';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_SCRIPT_INFO"."VERSION_RELEASE" IS '版本号';

-- ----------------------------
-- TABLE STRUCTURE FOR AGT_SCRIPT_INFO_RELEASE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."AGT_SCRIPT_INFO_RELEASE";
CREATE TABLE "KNOWLEDGE"."AGT_SCRIPT_INFO_RELEASE" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "SCRIPT_ID" VARCHAR COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "CODE_TYPE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "REL_PK_ID" VARCHAR COLLATE "PG_CATALOG"."DEFAULT",
  "SCRIPT_KIND" INT4,
  "PROJECT_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PROJECT_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PROJECT_URL" VARCHAR COLLATE "PG_CATALOG"."DEFAULT",
  "SCRIPT_INFO" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "SCRIPT_INFO_IMG" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "VERSION" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_BY" INT8,
  "CREATE_DATE" TIMESTAMP(6),
  "PROJECT_ID" INT8,
  "COM_ACCT_ID" INT8,
  "SCRIPT_LANGUAGE" VARCHAR COLLATE "PG_CATALOG"."DEFAULT",
  "SCRIPT_FRAME" VARCHAR COLLATE "PG_CATALOG"."DEFAULT",
  "IS_LOCK" CHAR(1) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT '0'::BPCHAR,
  "RUNNING_STATUS" INT4 DEFAULT 0,
  "VERSION_RELEASE" INT4 DEFAULT 1
)
;
COMMENT ON COLUMN "KNOWLEDGE"."AGT_SCRIPT_INFO_RELEASE"."SCRIPT_ID" IS 'AGT_SCRIPT_INFO表ID';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_SCRIPT_INFO_RELEASE"."IS_LOCK" IS '锁状态：1:锁，0：未锁';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_SCRIPT_INFO_RELEASE"."RUNNING_STATUS" IS '运行状态，1 成功 0 失败';
COMMENT ON COLUMN "KNOWLEDGE"."AGT_SCRIPT_INFO_RELEASE"."VERSION_RELEASE" IS '版本号';

-- ----------------------------
-- TABLE STRUCTURE FOR AGT_SYSTEM_PARAM_INFO
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."AGT_SYSTEM_PARAM_INFO";
CREATE TABLE "KNOWLEDGE"."AGT_SYSTEM_PARAM_INFO" (
  "SYS_PARAM_ID" INT8 NOT NULL,
  "SYS_PARAM_CODE" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "SYS_PARAM_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "SYS_PARAM_VALUE" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "SYS_PARAM_TYPE" VARCHAR(10) COLLATE "PG_CATALOG"."DEFAULT",
  "PROJECT_ID" INT8,
  "RULE_EXP" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_BY" INT4,
  "UPDATE_BY" INT4,
  "UPDATE_DATE" TIMESTAMP(6),
  "COM_ACCT_ID" INT8
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR AGT_TEMPLATE_INFO
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."AGT_TEMPLATE_INFO";
CREATE TABLE "KNOWLEDGE"."AGT_TEMPLATE_INFO" (
  "TEM_ID" INT8 NOT NULL,
  "TEMPLATE_NAME" VARCHAR(256) COLLATE "PG_CATALOG"."DEFAULT",
  "TEMPLATE_CODE" VARCHAR(256) COLLATE "PG_CATALOG"."DEFAULT",
  "TEMPLATE_DES" VARCHAR(256) COLLATE "PG_CATALOG"."DEFAULT",
  "SCRIPT_ID" VARCHAR(256) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_BY" INT8,
  "CREATE_DATE" TIMESTAMP(6)
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR AI_MODEL
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."AI_MODEL";
CREATE TABLE "KNOWLEDGE"."AI_MODEL" (
  "MODEL_ID" INT8 NOT NULL,
  "MODEL_TYPE" INT4,
  "MODEL_NAME" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "MODEL" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "URL" VARCHAR(2000) COLLATE "PG_CATALOG"."DEFAULT",
  "AUTH_TOKEN" VARCHAR(2000) COLLATE "PG_CATALOG"."DEFAULT",
  "STATUS" INT4,
  "IS_DEFAULT" INT4,
  "API_STYLE" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "OUT_SYS_MODEL_ID" INT8,
  "TEAM_ID" INT8,
  "TMB_ID" INT8,
  "REMARK" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_BY" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_BY" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "STREAM_TYPE" INT4,
  "IN_PARAMS" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "OUT_PARAMS" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "IS_SUPPORT_CHART" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "IS_SUPPORT_DOC" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "MODEL_ORDER" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "VIRTUAL_TYPE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT 0,
  "REAL_MODEL" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "DECISION_TYPE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT 'REACT'::CHARACTER VARYING,
  "SUPPORT_DECISION_PLUGIN" INT4 DEFAULT 1,
  "MODEL_JSON_CONFIG" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "SYSTEM_PROMPT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "MAX_OUTPUT_TOKEN" INT4,
  "MAX_TOKENS" INT4,
  "MODEL_CONCURRENCY" INT4 DEFAULT 20,
  "MODEL_USER_CONCURRENCY" INT4 DEFAULT 20,
  "MODEL_BASE_ID" INT8,
  "CUSTOMIZE" INT4,
  "DEEP_THINKING" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."AI_MODEL"."MODEL_TYPE" IS '1-大模型；2-小模型; 3-多模态';
COMMENT ON COLUMN "KNOWLEDGE"."AI_MODEL"."MODEL" IS 'QIANWEN13B/GPT3.5/XXX';
COMMENT ON COLUMN "KNOWLEDGE"."AI_MODEL"."STATUS" IS '是否可用。1-可用；其他-不可用。';
COMMENT ON COLUMN "KNOWLEDGE"."AI_MODEL"."IS_DEFAULT" IS '0:否，1：默认';
COMMENT ON COLUMN "KNOWLEDGE"."AI_MODEL"."API_STYLE" IS 'OPENAI/MAAS，不写默认OPENAI';
COMMENT ON COLUMN "KNOWLEDGE"."AI_MODEL"."STREAM_TYPE" IS '1-无限制；2-仅支持流式；3-仅支持非流式';
COMMENT ON COLUMN "KNOWLEDGE"."AI_MODEL"."IN_PARAMS" IS '入参';
COMMENT ON COLUMN "KNOWLEDGE"."AI_MODEL"."OUT_PARAMS" IS '出参';
COMMENT ON COLUMN "KNOWLEDGE"."AI_MODEL"."IS_SUPPORT_CHART" IS '是否支持图表问答';
COMMENT ON COLUMN "KNOWLEDGE"."AI_MODEL"."IS_SUPPORT_DOC" IS '是否支持文档问答';
COMMENT ON COLUMN "KNOWLEDGE"."AI_MODEL"."MODEL_ORDER" IS '大模型执行排序优先级';
COMMENT ON COLUMN "KNOWLEDGE"."AI_MODEL"."VIRTUAL_TYPE" IS '虚拟模型类型。0-真实模型；1-虚拟模型';
COMMENT ON COLUMN "KNOWLEDGE"."AI_MODEL"."DECISION_TYPE" IS '意图识别方式：REACT、FUNCTION';
COMMENT ON COLUMN "KNOWLEDGE"."AI_MODEL"."SUPPORT_DECISION_PLUGIN" IS '意图识别是否支持调用工具（插件工作流）: 1支持';
COMMENT ON COLUMN "KNOWLEDGE"."AI_MODEL"."MODEL_JSON_CONFIG" IS '调用大模型默认参数';
COMMENT ON COLUMN "KNOWLEDGE"."AI_MODEL"."SYSTEM_PROMPT" IS '系统提示词';
COMMENT ON COLUMN "KNOWLEDGE"."AI_MODEL"."MAX_OUTPUT_TOKEN" IS '最大回复上限';
COMMENT ON COLUMN "KNOWLEDGE"."AI_MODEL"."MAX_TOKENS" IS '模型最大TOKEN';
COMMENT ON COLUMN "KNOWLEDGE"."AI_MODEL"."MODEL_CONCURRENCY" IS '模型并发数';
COMMENT ON COLUMN "KNOWLEDGE"."AI_MODEL"."MODEL_USER_CONCURRENCY" IS '模型用户并发数';
COMMENT ON COLUMN "KNOWLEDGE"."AI_MODEL"."MODEL_BASE_ID" IS 'MODEL_BASE表对应ID';
COMMENT ON COLUMN "KNOWLEDGE"."AI_MODEL"."CUSTOMIZE" IS '是否非完整URL';
COMMENT ON COLUMN "KNOWLEDGE"."AI_MODEL"."DEEP_THINKING" IS '深度思考:0是，1否';

-- ----------------------------
-- TABLE STRUCTURE FOR AI_MODEL_2
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."AI_MODEL_2";
CREATE TABLE "KNOWLEDGE"."AI_MODEL_2" (
  "MODEL_ID" INT8 NOT NULL,
  "MODEL_TYPE" INT4,
  "MODEL_NAME" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "MODEL" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "URL" VARCHAR(2000) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "AUTH_TOKEN" VARCHAR(2000) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "STATUS" INT4,
  "IS_DEFAULT" INT4,
  "API_STYLE" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "OUT_SYS_MODEL_ID" INT8,
  "TEAM_ID" INT8,
  "TMB_ID" INT8,
  "REMARK" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "CREATE_BY" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_BY" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "STREAM_TYPE" INT4,
  "IN_PARAMS" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "OUT_PARAMS" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "IS_SUPPORT_CHART" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "IS_SUPPORT_DOC" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "MODEL_ORDER" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "VIRTUAL_TYPE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT '0'::CHARACTER VARYING,
  "REAL_MODEL" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "DECISION_TYPE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT 'REACT'::CHARACTER VARYING,
  "SUPPORT_DECISION_PLUGIN" INT4 DEFAULT 1,
  "MODEL_JSON_CONFIG" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "SYSTEM_PROMPT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "MAX_OUTPUT_TOKEN" INT4,
  "MAX_TOKENS" INT4
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR APP_DIR
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."APP_DIR";
CREATE TABLE "KNOWLEDGE"."APP_DIR" (
  "DIR_ID" INT8 NOT NULL,
  "DIR_CODE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "DIR_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "DIR_TYPE" INT4,
  "PARENT_DIR_ID" INT8,
  "PATH_CODE" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_BY" INT4,
  "UPDATE_BY" INT4,
  "UPDATE_DATE" TIMESTAMP(6),
  "COM_ACCT_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."APP_DIR"."DIR_ID" IS '目录ID';

-- ----------------------------
-- TABLE STRUCTURE FOR APP_FLOW_LOG
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."APP_FLOW_LOG";
CREATE TABLE "KNOWLEDGE"."APP_FLOW_LOG" (
  "APP_FLOW_ID" INT8 NOT NULL,
  "REL_APP_ID" INT8,
  "REL_FLOW_SUB_CODE" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "START_TIME" TIMESTAMP(6),
  "END_TIME" TIMESTAMP(6),
  "IN_PARAMS" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "OUT_PARAMS" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "STATUS" VARCHAR(3) COLLATE "PG_CATALOG"."DEFAULT",
  "ANS_STATUS" INT4,
  "OUT_PARAMS_STAND" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" INT8,
  "REQUEST_ID" INT8,
  "CREATE_USER" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "UPDATE_USER" INT8,
  "TMB_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."APP_FLOW_LOG"."APP_FLOW_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."APP_FLOW_LOG"."REL_APP_ID" IS '所属服务标识';
COMMENT ON COLUMN "KNOWLEDGE"."APP_FLOW_LOG"."REL_FLOW_SUB_CODE" IS '所属策略组件编码';
COMMENT ON COLUMN "KNOWLEDGE"."APP_FLOW_LOG"."START_TIME" IS '开始时间';
COMMENT ON COLUMN "KNOWLEDGE"."APP_FLOW_LOG"."END_TIME" IS '结束时间';
COMMENT ON COLUMN "KNOWLEDGE"."APP_FLOW_LOG"."IN_PARAMS" IS '入参';
COMMENT ON COLUMN "KNOWLEDGE"."APP_FLOW_LOG"."OUT_PARAMS" IS '出参';
COMMENT ON COLUMN "KNOWLEDGE"."APP_FLOW_LOG"."STATUS" IS '状态';
COMMENT ON COLUMN "KNOWLEDGE"."APP_FLOW_LOG"."ANS_STATUS" IS '点赞状态';
COMMENT ON COLUMN "KNOWLEDGE"."APP_FLOW_LOG"."OUT_PARAMS_STAND" IS '出参纠正';
COMMENT ON COLUMN "KNOWLEDGE"."APP_FLOW_LOG"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."APP_FLOW_LOG"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."APP_FLOW_LOG"."REQUEST_ID" IS '请求ID';
COMMENT ON TABLE "KNOWLEDGE"."APP_FLOW_LOG" IS '知识服务策略日志表';

-- ----------------------------
-- TABLE STRUCTURE FOR APP_MCP_INFO
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."APP_MCP_INFO";
CREATE TABLE "KNOWLEDGE"."APP_MCP_INFO" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "MCP_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "LABEL" INT4 NOT NULL DEFAULT 0,
  "MSG" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "DIS_TYPE" INT4 NOT NULL,
  "LANGUAGE_TYPE" INT4,
  "INTRODUCE" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "AGENT_TEAM_ID" INT8,
  "AVATAR" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 NOT NULL DEFAULT 0,
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(2) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "SYSTEM_LEVEL" INT4 DEFAULT 0
)
;
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO"."ID" IS '主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO"."MCP_NAME" IS 'MCP名称';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO"."LABEL" IS '标签';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO"."MSG" IS '描述';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO"."DIS_TYPE" IS '通讯类型0 JAR 1 流式';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO"."LANGUAGE_TYPE" IS '部署环境类型 0 PYTHON  1 JAVA ';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO"."INTRODUCE" IS '介绍';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO"."AGENT_TEAM_ID" IS '团队ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO"."AVATAR" IS '头图';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO"."DELETE_FLAG" IS '删除状态(0:正常 1:删除) ';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO"."UPDATE_NAME" IS '更新人名';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO"."BUREAU_CODE" IS '省编码';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO"."SYSTEM_LEVEL" IS '系统级MCP 0否 1是';
COMMENT ON TABLE "KNOWLEDGE"."APP_MCP_INFO" IS '智能体MCP组件基本信息表';

-- ----------------------------
-- TABLE STRUCTURE FOR APP_MCP_INFO_RELEASE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."APP_MCP_INFO_RELEASE";
CREATE TABLE "KNOWLEDGE"."APP_MCP_INFO_RELEASE" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "MCP_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "MCP_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "LABEL" INT4 NOT NULL DEFAULT 0,
  "MSG" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "DIS_TYPE" INT4 NOT NULL,
  "LANGUAGE_TYPE" INT4,
  "INTRODUCE" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "AGENT_TEAM_ID" INT8,
  "AVATAR" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 NOT NULL DEFAULT 0,
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(2) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "IS_LATEST" INT2 DEFAULT 1
)
;
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO_RELEASE"."ID" IS '主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO_RELEASE"."MCP_ID" IS '原信息表MCPID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO_RELEASE"."MCP_NAME" IS 'MCP名称';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO_RELEASE"."LABEL" IS '标签';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO_RELEASE"."MSG" IS '描述';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO_RELEASE"."DIS_TYPE" IS '通讯类型0 JAR 1 流式';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO_RELEASE"."LANGUAGE_TYPE" IS '部署环境类型 0 PYTHON  1 JAVA ';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO_RELEASE"."INTRODUCE" IS '介绍';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO_RELEASE"."AGENT_TEAM_ID" IS '团队ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO_RELEASE"."AVATAR" IS '头图';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO_RELEASE"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO_RELEASE"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO_RELEASE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO_RELEASE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO_RELEASE"."DELETE_FLAG" IS '删除状态(0:正常 1:删除) ';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO_RELEASE"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO_RELEASE"."UPDATE_NAME" IS '更新人名';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO_RELEASE"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO_RELEASE"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO_RELEASE"."BUREAU_CODE" IS '省编码';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO_RELEASE"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_INFO_RELEASE"."IS_LATEST" IS '是否最后的版本(1:是；0:否)';
COMMENT ON TABLE "KNOWLEDGE"."APP_MCP_INFO_RELEASE" IS '智能体MCP组件基本信息表';

-- ----------------------------
-- TABLE STRUCTURE FOR APP_MCP_JAR_INFO
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."APP_MCP_JAR_INFO";
CREATE TABLE "KNOWLEDGE"."APP_MCP_JAR_INFO" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "MCP_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "JAR_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "JAR_PATH" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "START_COMMON" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "VERSION" VARCHAR(16) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_MSG" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "START_STATUS" INT4 NOT NULL DEFAULT 0,
  "TOOLS" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 NOT NULL DEFAULT 0,
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(2) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO"."ID" IS '主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO"."MCP_ID" IS 'MCPID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO"."JAR_NAME" IS 'JAR文件名称';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO"."JAR_PATH" IS 'JAR文件路径/流式URL';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO"."START_COMMON" IS '启动参数';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO"."VERSION" IS '版本号';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO"."UPDATE_MSG" IS '更新说明';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO"."START_STATUS" IS '是否启用 0 未启用 1 已启用';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO"."TOOLS" IS '工具列表JSON';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO"."DELETE_FLAG" IS '删除状态(0:正常 1:删除) ';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO"."UPDATE_NAME" IS '更新人名';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO"."BUREAU_CODE" IS '省编码';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON TABLE "KNOWLEDGE"."APP_MCP_JAR_INFO" IS '智能体MCP组件(JAR包/流式)信息表';

-- ----------------------------
-- TABLE STRUCTURE FOR APP_MCP_JAR_INFO_RELEASE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE";
CREATE TABLE "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "MCP_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "JAR_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "JAR_PATH" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "START_COMMON" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "VERSION" VARCHAR(16) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_MSG" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "START_STATUS" INT4 NOT NULL DEFAULT 0,
  "TOOLS" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 NOT NULL DEFAULT 0,
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(2) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE"."ID" IS '主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE"."MCP_ID" IS 'MCPID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE"."JAR_NAME" IS 'JAR文件名称';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE"."JAR_PATH" IS 'JAR文件路径/流式URL';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE"."START_COMMON" IS '启动参数';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE"."VERSION" IS '版本号';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE"."UPDATE_MSG" IS '更新说明';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE"."START_STATUS" IS '是否启用 0 未启用 1 已启用';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE"."TOOLS" IS '工具列表JSON';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE"."DELETE_FLAG" IS '删除状态(0:正常 1:删除) ';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE"."UPDATE_NAME" IS '更新人名';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE"."BUREAU_CODE" IS '省编码';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON TABLE "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE" IS '智能体MCP组件(JAR包/流式)信息表';

-- ----------------------------
-- TABLE STRUCTURE FOR APP_MCP_SERVER
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."APP_MCP_SERVER";
CREATE TABLE "KNOWLEDGE"."APP_MCP_SERVER" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "MCP_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "JAR_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "JAR_PATH" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "START_COMMON" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "VERSION" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_MSG" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "START_STATUS" INT4 NOT NULL DEFAULT 0,
  "TOOLS" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 NOT NULL DEFAULT 0,
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(2) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "HTTP_PROTOCOL" VARCHAR COLLATE "PG_CATALOG"."DEFAULT" DEFAULT ' HTTP'::CHARACTER VARYING
)
;
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER"."ID" IS '主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER"."MCP_ID" IS 'MCPID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER"."JAR_NAME" IS 'JAR文件名称';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER"."JAR_PATH" IS 'JAR文件路径/流式URL';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER"."START_COMMON" IS '启动参数';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER"."VERSION" IS '版本号';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER"."UPDATE_MSG" IS '更新说明';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER"."START_STATUS" IS '是否启用 0 未启用 1 已启用';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER"."TOOLS" IS '工具列表JSON';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER"."DELETE_FLAG" IS '删除状态(0:正常 1:删除) ';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER"."UPDATE_NAME" IS '更新人名';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER"."BUREAU_CODE" IS '省编码';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER"."HTTP_PROTOCOL" IS 'HTTP协议(HTTP:HTTP协议;HTTPS:HTTPS协议)';
COMMENT ON TABLE "KNOWLEDGE"."APP_MCP_SERVER" IS '智能体MCP组件(JAR包/流式)信息表';

-- ----------------------------
-- TABLE STRUCTURE FOR APP_MCP_SERVER_RELEASE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."APP_MCP_SERVER_RELEASE";
CREATE TABLE "KNOWLEDGE"."APP_MCP_SERVER_RELEASE" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "MCP_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "JAR_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "JAR_PATH" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "START_COMMON" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "VERSION" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_MSG" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "START_STATUS" INT4 NOT NULL DEFAULT 0,
  "TOOLS" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 NOT NULL DEFAULT 0,
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(2) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "HTTP_PROTOCOL" VARCHAR COLLATE "PG_CATALOG"."DEFAULT" DEFAULT 'HTTP'::CHARACTER VARYING,
  "MCP_RELEASE_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER_RELEASE"."ID" IS '主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER_RELEASE"."MCP_ID" IS 'MCPID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER_RELEASE"."JAR_NAME" IS 'JAR文件名称';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER_RELEASE"."JAR_PATH" IS 'JAR文件路径/流式URL';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER_RELEASE"."START_COMMON" IS '启动参数';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER_RELEASE"."VERSION" IS '版本号';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER_RELEASE"."UPDATE_MSG" IS '更新说明';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER_RELEASE"."START_STATUS" IS '是否启用 0 未启用 1 已启用';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER_RELEASE"."TOOLS" IS '工具列表JSON';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER_RELEASE"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER_RELEASE"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER_RELEASE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER_RELEASE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER_RELEASE"."DELETE_FLAG" IS '删除状态(0:正常 1:删除) ';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER_RELEASE"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER_RELEASE"."UPDATE_NAME" IS '更新人名';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER_RELEASE"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER_RELEASE"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER_RELEASE"."BUREAU_CODE" IS '省编码';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER_RELEASE"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER_RELEASE"."HTTP_PROTOCOL" IS 'HTTP协议(HTTP:HTTP协议;HTTPS:HTTPS协议)';
COMMENT ON COLUMN "KNOWLEDGE"."APP_MCP_SERVER_RELEASE"."MCP_RELEASE_ID" IS '发布MCP的ID';
COMMENT ON TABLE "KNOWLEDGE"."APP_MCP_SERVER_RELEASE" IS '智能体MCP组件(JAR包/流式)信息表';

-- ----------------------------
-- TABLE STRUCTURE FOR APP_OPEN_MAN
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."APP_OPEN_MAN";
CREATE TABLE "KNOWLEDGE"."APP_OPEN_MAN" (
  "OPEN_MAN_ID" INT8 NOT NULL,
  "API_KEY" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "APP_ID" INT8,
  "NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "LIMIT_TOPK" INT4,
  "USAGE" INT4,
  "OPEN_TYPE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" INT8,
  "TMB_ID" INT8,
  "NO_LOGIN" VARCHAR(3) COLLATE "PG_CATALOG"."DEFAULT",
  "APP_CLASSIFY" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "STATUS" INT2 DEFAULT 0,
  "SHOW_URL" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "TOKEN_STR" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "EXPIRE_DATE" TIMESTAMP(6),
  "SYSTEM_OPEN_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."APP_OPEN_MAN"."OPEN_MAN_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."APP_OPEN_MAN"."API_KEY" IS '应用秘钥';
COMMENT ON COLUMN "KNOWLEDGE"."APP_OPEN_MAN"."APP_ID" IS '应用标识';
COMMENT ON COLUMN "KNOWLEDGE"."APP_OPEN_MAN"."NAME" IS '应用名称';
COMMENT ON COLUMN "KNOWLEDGE"."APP_OPEN_MAN"."LIMIT_TOPK" IS '调用次数限制';
COMMENT ON COLUMN "KNOWLEDGE"."APP_OPEN_MAN"."USAGE" IS '调用次数';
COMMENT ON COLUMN "KNOWLEDGE"."APP_OPEN_MAN"."OPEN_TYPE" IS '开放方式';
COMMENT ON COLUMN "KNOWLEDGE"."APP_OPEN_MAN"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."APP_OPEN_MAN"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."APP_OPEN_MAN"."TMB_ID" IS 'TMB_ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_OPEN_MAN"."NO_LOGIN" IS '是否免登录';
COMMENT ON COLUMN "KNOWLEDGE"."APP_OPEN_MAN"."APP_CLASSIFY" IS '智能体广场数据分类';
COMMENT ON COLUMN "KNOWLEDGE"."APP_OPEN_MAN"."STATUS" IS '智能体发布状态 0：未发布 1：发布';
COMMENT ON COLUMN "KNOWLEDGE"."APP_OPEN_MAN"."SHOW_URL" IS '短URL';
COMMENT ON COLUMN "KNOWLEDGE"."APP_OPEN_MAN"."TOKEN_STR" IS 'H5外链访问的TOKEN';
COMMENT ON COLUMN "KNOWLEDGE"."APP_OPEN_MAN"."EXPIRE_DATE" IS 'H5外链失效时间';
COMMENT ON COLUMN "KNOWLEDGE"."APP_OPEN_MAN"."SYSTEM_OPEN_ID" IS '系统开放ID';
COMMENT ON TABLE "KNOWLEDGE"."APP_OPEN_MAN" IS '应用开放管理表';

-- ----------------------------
-- TABLE STRUCTURE FOR APP_OPENAPI_DOC
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."APP_OPENAPI_DOC";
CREATE TABLE "KNOWLEDGE"."APP_OPENAPI_DOC" (
  "I_ID" INT8 NOT NULL,
  "OPEN_TYPE" VARCHAR(3) COLLATE "PG_CATALOG"."DEFAULT",
  "DOCS_URL" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."APP_OPENAPI_DOC"."I_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."APP_OPENAPI_DOC"."OPEN_TYPE" IS '开放方式';
COMMENT ON COLUMN "KNOWLEDGE"."APP_OPENAPI_DOC"."DOCS_URL" IS '接口文档说明';
COMMENT ON TABLE "KNOWLEDGE"."APP_OPENAPI_DOC" IS '开放接口说明文档';

-- ----------------------------
-- TABLE STRUCTURE FOR APP_VERSION_DRAFT
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."APP_VERSION_DRAFT";
CREATE TABLE "KNOWLEDGE"."APP_VERSION_DRAFT" (
  "DRAFT_ID" INT8 NOT NULL,
  "VERSION_INFO_ID" INT8,
  "OPERATION_TYPE" CHAR(2) COLLATE "PG_CATALOG"."DEFAULT",
  "ACTION_TYPE" CHAR(1) COLLATE "PG_CATALOG"."DEFAULT",
  "OPERATION_CONTENT" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_DRAFT"."DRAFT_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_DRAFT"."VERSION_INFO_ID" IS '智能体版本记录表ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_DRAFT"."OPERATION_TYPE" IS '操作项（0基本信息、1提示词、2大模型、3插件、4工作流、5MCP、6数据库、7知识库、8开场白、9推荐问题、10模型参数、11意图模式、12召回设置、13调用设置）';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_DRAFT"."ACTION_TYPE" IS '操作类型（0添加、1修改、2删除）';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_DRAFT"."OPERATION_CONTENT" IS '操作详情';
COMMENT ON TABLE "KNOWLEDGE"."APP_VERSION_DRAFT" IS '智能体版本草稿信息表';

-- ----------------------------
-- TABLE STRUCTURE FOR APP_VERSION_INFO
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."APP_VERSION_INFO";
CREATE TABLE "KNOWLEDGE"."APP_VERSION_INFO" (
  "VERSION_INFO_ID" INT8 NOT NULL,
  "APP_ID" INT8,
  "CURRENT_VERSION" CHAR(1) COLLATE "PG_CATALOG"."DEFAULT",
  "VERSION_TYPE" CHAR(1) COLLATE "PG_CATALOG"."DEFAULT",
  "VERSION_NUM" VARCHAR(60) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "SMART_LABEL_ID" INT4,
  "APP_NAME" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "SMART_LABEL_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "APP_INTRO" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "PROMPT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "MODEL_ID" INT8,
  "MODEL_NAME" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "NOTICE_FLAG" CHAR(1) COLLATE "PG_CATALOG"."DEFAULT",
  "QUESTION_OPEN_INTRO" JSON,
  "QUESTION_SAMPLE_EXAMPLE" JSON,
  "APP_AVATAR" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "RETRIEVAL_INFO" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "SAMPLE" INT4 DEFAULT 0,
  "ANSWER_TYPE" INT4,
  "OUTPUT_TYPE" INT4,
  "AFFILIATE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."VERSION_INFO_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."APP_ID" IS '智能体ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."CURRENT_VERSION" IS '是否当前版本(0否、1是)';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."VERSION_TYPE" IS '版本类型（0草稿版本、1发布版本）';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."VERSION_NUM" IS '版本号';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."UPDATE_NAME" IS '更新人名';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."SMART_LABEL_ID" IS '标签ID（所属业务域ID）';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."APP_NAME" IS '智能体名称';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."SMART_LABEL_NAME" IS '标签名称（所属业务域名称）';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."APP_INTRO" IS '智能体功能描述';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."PROMPT" IS '指令集';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."MODEL_ID" IS '模型ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."MODEL_NAME" IS '模型名称';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."NOTICE_FLAG" IS '是否提醒（0不提醒、1提醒）';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."QUESTION_OPEN_INTRO" IS '开场白';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."QUESTION_SAMPLE_EXAMPLE" IS '简单问题';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."APP_AVATAR" IS '智能体头像';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."RETRIEVAL_INFO" IS '知识库查询配置';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."SAMPLE" IS '智能体模式  0正常模型、 1简单模式';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."ANSWER_TYPE" IS '回答方式，0：模型回答、 1：直接回答';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."OUTPUT_TYPE" IS '输出方式，0：流式输出 、1：非流式输出';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_INFO"."AFFILIATE" IS '大模型参数（JSON）';
COMMENT ON TABLE "KNOWLEDGE"."APP_VERSION_INFO" IS '智能体版本记录表';

-- ----------------------------
-- TABLE STRUCTURE FOR APP_VERSION_PUBLISH
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."APP_VERSION_PUBLISH";
CREATE TABLE "KNOWLEDGE"."APP_VERSION_PUBLISH" (
  "PUBLISH_ID" INT8 NOT NULL,
  "VERSION_INFO_ID" INT8,
  "VERSION_DESC" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "PUBLISHER_ID" INT8,
  "PUBLISHER_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "PUBLISH_TIME" TIMESTAMP(6),
  "VISIBILITY_FLAG" INT4,
  "OPEN_SERVICE_FLAG" INT4,
  "TEMPLATE_FLAG" CHAR(1) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_PUBLISH"."PUBLISH_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_PUBLISH"."VERSION_INFO_ID" IS '智能体版本记录表ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_PUBLISH"."VERSION_DESC" IS '版本描述';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_PUBLISH"."PUBLISHER_ID" IS '发布人ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_PUBLISH"."PUBLISHER_NAME" IS '发布人名称';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_PUBLISH"."PUBLISH_TIME" IS '发布时间';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_PUBLISH"."VISIBILITY_FLAG" IS '可见性（0私有、1公开）';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_PUBLISH"."OPEN_SERVICE_FLAG" IS '是否发布为开放服务（0否、1是）';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_PUBLISH"."TEMPLATE_FLAG" IS '是否发布为模板（0否、1是）';
COMMENT ON TABLE "KNOWLEDGE"."APP_VERSION_PUBLISH" IS '智能体版本发布信息表';

-- ----------------------------
-- TABLE STRUCTURE FOR APP_VERSION_REL
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."APP_VERSION_REL";
CREATE TABLE "KNOWLEDGE"."APP_VERSION_REL" (
  "REL_ID" INT8 NOT NULL,
  "VERSION_INFO_ID" INT8,
  "DEPEND_TYPE" CHAR(1) COLLATE "PG_CATALOG"."DEFAULT",
  "DEPEND_VERSION" VARCHAR(10) COLLATE "PG_CATALOG"."DEFAULT",
  "EXTEND_DATA" JSON,
  "DEPEND_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "DEPEND_NAME" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_REL"."REL_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_REL"."VERSION_INFO_ID" IS '智能体版本记录表主键';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_REL"."DEPEND_TYPE" IS '依赖类型（0插件、1工作流、2知识库、3MCP、4数据库）';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_REL"."DEPEND_VERSION" IS '依赖的版本';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_REL"."EXTEND_DATA" IS '额外数据，比如插件里面依赖了工具';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_REL"."DEPEND_ID" IS '依赖的ID';
COMMENT ON COLUMN "KNOWLEDGE"."APP_VERSION_REL"."DEPEND_NAME" IS '依赖的名称';
COMMENT ON TABLE "KNOWLEDGE"."APP_VERSION_REL" IS '版本依赖表';

-- ----------------------------
-- TABLE STRUCTURE FOR APPS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."APPS";
CREATE TABLE "KNOWLEDGE"."APPS" (
  "ID" INT8 NOT NULL,
  "AVATAR" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "INTRO" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "MODULES" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "NAME" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "PERMISSION" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "SIMPLE_TEMPLATE_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TEAM_ID" INT8,
  "TMB_ID" INT8,
  "TYPE" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "CREATE_TIME" TIMESTAMP(6),
  "CREATE_USER" INT8,
  "UPDATE_USER" INT8,
  "SOURCE" INT4,
  "V" INT4,
  "REL_MODEL_ID" INT8,
  "PROLOGUE" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "FEEDBACK_TIPS" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "PROJECT_ID" INT8,
  "CODE_TYPE" INT4,
  "STATUS" INT4 DEFAULT 2,
  "DIR_ID" INT8,
  "SCRIPT_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "APP_TYPE" INT4,
  "SMART_LABEL_ID" INT4,
  "PROMPT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "AFFILIATE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "RETRIEVAL_INFO" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CHAT_APP_TYPE" INT4 DEFAULT 0,
  "HAS_RECOMMEND" INT4 DEFAULT 0,
  "SKIP_URL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "VERSION_RELEASE" INT8 DEFAULT 1,
  "AGENT_TEAM_ID" INT8,
  "SECURITY_FILTER_TYPE" INT4 DEFAULT 1,
  "SAMPLE" INT4 DEFAULT 0,
  "ANSWER_TYPE" INT4,
  "OUTPUT_TYPE" INT4,
  "CREATE_TYPE" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "PUBLISH_FLAG" CHAR(1) COLLATE "PG_CATALOG"."DEFAULT",
  "QUERY_DATASET_SOURCE" INT4,
  "PLAZA_DISPLAY" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT 1,
  "PLAZA_DISPLAY_REMARK" VARCHAR(1024) COLLATE "PG_CATALOG"."DEFAULT",
  "CATEGORY_PINNING" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT 2,
  "RETRIEVAL_INFO_ENHANCE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "OPERATION_UPDATE_TIME" TIMESTAMP(6),
  "OPERATION_UPDATE_USER" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."ID" IS '主键标识';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."AVATAR" IS '应用LOGO';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."INTRO" IS '应用简介';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."MODULES" IS '应用编排内容';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."NAME" IS '应用名称';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."PERMISSION" IS '权限';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."SIMPLE_TEMPLATE_ID" IS '简易模板';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."TMB_ID" IS 'TMB_ID';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."TYPE" IS '类型';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."CREATE_USER" IS '创建用户';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."UPDATE_USER" IS '更新用户';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."SOURCE" IS '来源。NIL-用户手动创建；0-系统默认创建；1-用户手动创建；2-大瓦特功能工具';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."REL_MODEL_ID" IS '基础大模型ID';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."FEEDBACK_TIPS" IS '自定义反馈';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."PROJECT_ID" IS '项目ID';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."CODE_TYPE" IS '编排方式：1:高代码，2：低代码：3：表单向导';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."STATUS" IS '状态：1:已发布，2：已下线';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."DIR_ID" IS '所属目录ID';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."SCRIPT_ID" IS '脚本ID';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."APP_TYPE" IS '智能体类型： 1，单智能体， 2，复合智能体';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."SMART_LABEL_ID" IS '标签ID';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."PROMPT" IS '指令集';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."RETRIEVAL_INFO" IS '知识库查询配置';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."CHAT_APP_TYPE" IS '智能体聊天类型  0：页面显示 1：提供给AI聊天';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."HAS_RECOMMEND" IS '是否推荐 默认：0：否  1：是 ';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."SKIP_URL" IS '跳转外部地址';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."VERSION_RELEASE" IS '版本号';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."AGENT_TEAM_ID" IS '平台团队ID';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."SECURITY_FILTER_TYPE" IS '安全过滤 0 不启用 1 启用';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."SAMPLE" IS '智能体模式 0正常模型 1简单模式';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."ANSWER_TYPE" IS '回答方式，0：模型回答 1：直接回答';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."OUTPUT_TYPE" IS '输出方式，0：流式输出 1：非流式输出';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."CREATE_TYPE" IS '创建方式：针对模板创建提示改名字  值为模板名字';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."PUBLISH_FLAG" IS '智能体的改动是否已发布(0未发布、1已发布)';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."QUERY_DATASET_SOURCE" IS '查询知识库来源: 1：DOCCHAIN';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."PLAZA_DISPLAY" IS '广场展示(1.开启，2.关闭)';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."PLAZA_DISPLAY_REMARK" IS '⼴场取消展⽰原因';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."CATEGORY_PINNING" IS '分类置顶(1.是，2.否)';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."RETRIEVAL_INFO_ENHANCE" IS '知识库增强召回配置';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."OPERATION_UPDATE_TIME" IS '⼴场展⽰操作、置顶操作⾏为的最新操作时间';
COMMENT ON COLUMN "KNOWLEDGE"."APPS"."OPERATION_UPDATE_USER" IS '操作⼈';
COMMENT ON TABLE "KNOWLEDGE"."APPS" IS '知识服务策略表';

-- ----------------------------
-- TABLE STRUCTURE FOR APPS_20250724
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."APPS_20250724";
CREATE TABLE "KNOWLEDGE"."APPS_20250724" (
  "ID" INT8,
  "AVATAR" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "INTRO" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "MODULES" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "NAME" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "PERMISSION" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "SIMPLE_TEMPLATE_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TEAM_ID" INT8,
  "TMB_ID" INT8,
  "TYPE" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "CREATE_TIME" TIMESTAMP(6),
  "CREATE_USER" INT8,
  "UPDATE_USER" INT8,
  "SOURCE" INT4,
  "V" INT4,
  "REL_MODEL_ID" INT8,
  "PROLOGUE" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "FEEDBACK_TIPS" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "PROJECT_ID" INT8,
  "CODE_TYPE" INT4,
  "STATUS" INT4,
  "DIR_ID" INT8,
  "SCRIPT_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "APP_TYPE" INT4,
  "SMART_LABEL_ID" INT4,
  "PROMPT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "AFFILIATE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "RETRIEVAL_INFO" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CHAT_APP_TYPE" INT4,
  "HAS_RECOMMEND" INT4,
  "SKIP_URL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "VERSION_RELEASE" INT4,
  "AGENT_TEAM_ID" INT8,
  "SECURITY_FILTER_TYPE" INT4,
  "SAMPLE" INT4,
  "ANSWER_TYPE" INT4,
  "OUTPUT_TYPE" INT4,
  "CREATE_TYPE" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "PUBLISH_FLAG" CHAR(1) COLLATE "PG_CATALOG"."DEFAULT"
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR APPS_FAVORITE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."APPS_FAVORITE";
CREATE TABLE "KNOWLEDGE"."APPS_FAVORITE" (
  "APPS_FAVORITE_ID" INT8 NOT NULL,
  "APP_ID" INT8,
  "CREATE_BY" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."APPS_FAVORITE"."APPS_FAVORITE_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_FAVORITE"."APP_ID" IS '应用标识ID';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_FAVORITE"."CREATE_BY" IS '收藏人';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_FAVORITE"."CREATE_TIME" IS '收藏时间';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_FAVORITE"."TEAM_ID" IS '所属团队ID';

-- ----------------------------
-- TABLE STRUCTURE FOR APPS_LABEL_HINT
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."APPS_LABEL_HINT";
CREATE TABLE "KNOWLEDGE"."APPS_LABEL_HINT" (
  "APPS_ID" INT8 NOT NULL,
  "HINT_TYPE" INT4 DEFAULT 0,
  "ORG_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT4 DEFAULT 0,
  "INIT_LABEL_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "BUSINESS_DOMAIN" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."APPS_LABEL_HINT"."APPS_ID" IS '智能体ID';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_LABEL_HINT"."HINT_TYPE" IS '是否还需要提示，0：需要  1：不需要';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_LABEL_HINT"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_LABEL_HINT"."ORG_CODE" IS '组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_LABEL_HINT"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_LABEL_HINT"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_LABEL_HINT"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_LABEL_HINT"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_LABEL_HINT"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_LABEL_HINT"."UPDATE_NAME" IS '更新人名称';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_LABEL_HINT"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_LABEL_HINT"."DELETE_FLAG" IS '删除状态(0:正常 1:删除)';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_LABEL_HINT"."INIT_LABEL_NAME" IS '原标签名';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_LABEL_HINT"."BUSINESS_DOMAIN" IS '业务域';
COMMENT ON TABLE "KNOWLEDGE"."APPS_LABEL_HINT" IS '标签修改提示表';

-- ----------------------------
-- TABLE STRUCTURE FOR APPS_RELEASE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."APPS_RELEASE";
CREATE TABLE "KNOWLEDGE"."APPS_RELEASE" (
  "TABLE_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "ID" INT8 NOT NULL,
  "AVATAR" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "INTRO" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "MODULES" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "NAME" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "PERMISSION" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "SIMPLE_TEMPLATE_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TEAM_ID" INT8,
  "TMB_ID" INT8,
  "TYPE" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "CREATE_TIME" TIMESTAMP(6),
  "CREATE_USER" INT8,
  "UPDATE_USER" INT8,
  "SOURCE" INT4,
  "V" INT4,
  "REL_MODEL_ID" INT8,
  "PROLOGUE" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "FEEDBACK_TIPS" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "PROJECT_ID" INT8,
  "CODE_TYPE" INT4,
  "STATUS" INT4 DEFAULT 2,
  "DIR_ID" INT8,
  "SCRIPT_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "APP_TYPE" INT4,
  "SMART_LABEL_ID" INT4,
  "PROMPT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "AFFILIATE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "RETRIEVAL_INFO" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CHAT_APP_TYPE" INT4 DEFAULT 0,
  "HAS_RECOMMEND" INT4 DEFAULT 0,
  "SKIP_URL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "VERSION_RELEASE" INT8 DEFAULT 1,
  "AGENT_TEAM_ID" INT8,
  "HAS_RECOMMEND_SORT" INT4 DEFAULT 1,
  "SECURITY_FILTER_TYPE" INT4 DEFAULT 1,
  "SAMPLE" INT4 DEFAULT 0,
  "ANSWER_TYPE" INT4,
  "OUTPUT_TYPE" INT4,
  "CREATE_TYPE" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "QUERY_DATASET_SOURCE" INT4,
  "PLAZA_DISPLAY" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT 1,
  "PLAZA_DISPLAY_REMARK" VARCHAR(1024) COLLATE "PG_CATALOG"."DEFAULT",
  "CATEGORY_PINNING" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT 2,
  "RETRIEVAL_INFO_ENHANCE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "OPERATION_UPDATE_TIME" TIMESTAMP(6),
  "OPERATION_UPDATE_USER" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."ID" IS '对应APPS表 ID';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."AVATAR" IS '应用LOGO';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."INTRO" IS '应用简介';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."MODULES" IS '应用编排内容';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."NAME" IS '应用名称';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."PERMISSION" IS '权限';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."SIMPLE_TEMPLATE_ID" IS '简易模板';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."TMB_ID" IS 'TMB_ID';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."TYPE" IS '类型';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."CREATE_USER" IS '创建用户';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."UPDATE_USER" IS '更新用户';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."SOURCE" IS '来源。NIL-用户手动创建；0-系统默认创建；1-用户手动创建；2-大瓦特功能工具';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."REL_MODEL_ID" IS '基础大模型ID';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."FEEDBACK_TIPS" IS '自定义反馈';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."PROJECT_ID" IS '项目ID';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."CODE_TYPE" IS '编排方式：1:高代码，2：低代码：3：表单向导';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."STATUS" IS '状态：1:已发布，2：已下线';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."DIR_ID" IS '所属目录ID';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."SCRIPT_ID" IS '脚本ID';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."APP_TYPE" IS '智能体类型： 1，单智能体， 2，复合智能体';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."SMART_LABEL_ID" IS '标签ID';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."PROMPT" IS '指令集';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."RETRIEVAL_INFO" IS '知识库查询配置';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."CHAT_APP_TYPE" IS '智能体聊天类型  0：页面显示 1：提供给AI聊天';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."HAS_RECOMMEND" IS '是否推荐 默认：0：否  1：是 ';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."SKIP_URL" IS '跳转外部地址';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."VERSION_RELEASE" IS '版本号';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."AGENT_TEAM_ID" IS '团队平台ID';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."HAS_RECOMMEND_SORT" IS '是否推荐排序';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."SECURITY_FILTER_TYPE" IS '安全过滤 0 不启用 1启用';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."SAMPLE" IS '智能体模式 0正常模型 1简单模式';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."ANSWER_TYPE" IS '回答方式，0：模型回答 1：直接回答';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."OUTPUT_TYPE" IS '输出方式，0：非流式输出 1：流式输出';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."CREATE_TYPE" IS '创建方式：针对模板创建提示改名字  值为模板名字';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."QUERY_DATASET_SOURCE" IS '查询知识库来源: 1：DOCCHAIN';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."PLAZA_DISPLAY" IS '广场展示(1.开启，2.关闭)';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."PLAZA_DISPLAY_REMARK" IS '⼴场取消展⽰原因';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."CATEGORY_PINNING" IS '分类置顶(1.是，2.否)';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."RETRIEVAL_INFO_ENHANCE" IS '知识库增强召回配置';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."OPERATION_UPDATE_TIME" IS '⼴场展⽰操作、置顶操作⾏为的最新操作时间';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_RELEASE"."OPERATION_UPDATE_USER" IS '操作⼈';
COMMENT ON TABLE "KNOWLEDGE"."APPS_RELEASE" IS '智能体发布表';

-- ----------------------------
-- TABLE STRUCTURE FOR APPS_RELEASE_20250724
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."APPS_RELEASE_20250724";
CREATE TABLE "KNOWLEDGE"."APPS_RELEASE_20250724" (
  "TABLE_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ID" INT8,
  "AVATAR" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "INTRO" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "MODULES" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "NAME" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "PERMISSION" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "SIMPLE_TEMPLATE_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TEAM_ID" INT8,
  "TMB_ID" INT8,
  "TYPE" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "CREATE_TIME" TIMESTAMP(6),
  "CREATE_USER" INT8,
  "UPDATE_USER" INT8,
  "SOURCE" INT4,
  "V" INT4,
  "REL_MODEL_ID" INT8,
  "PROLOGUE" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "FEEDBACK_TIPS" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "PROJECT_ID" INT8,
  "CODE_TYPE" INT4,
  "STATUS" INT4,
  "DIR_ID" INT8,
  "SCRIPT_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "APP_TYPE" INT4,
  "SMART_LABEL_ID" INT4,
  "PROMPT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "AFFILIATE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "RETRIEVAL_INFO" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CHAT_APP_TYPE" INT4,
  "HAS_RECOMMEND" INT4,
  "SKIP_URL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "VERSION_RELEASE" INT4,
  "AGENT_TEAM_ID" INT8,
  "HAS_RECOMMEND_SORT" INT4,
  "SECURITY_FILTER_TYPE" INT4,
  "SAMPLE" INT4,
  "ANSWER_TYPE" INT4,
  "OUTPUT_TYPE" INT4,
  "CREATE_TYPE" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT"
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR APPS_USER_EVAL
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."APPS_USER_EVAL";
CREATE TABLE "KNOWLEDGE"."APPS_USER_EVAL" (
  "APPS_USER_EVAL_ID" INT8 NOT NULL,
  "APP_ID" INT8,
  "TYPE" INT2,
  "CREATE_BY" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."APPS_USER_EVAL"."APPS_USER_EVAL_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_USER_EVAL"."APP_ID" IS '应用标识ID';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_USER_EVAL"."TYPE" IS '点赞类型';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_USER_EVAL"."CREATE_BY" IS '点赞人';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_USER_EVAL"."CREATE_TIME" IS '点赞时间';
COMMENT ON COLUMN "KNOWLEDGE"."APPS_USER_EVAL"."TEAM_ID" IS '所属团队';

-- ----------------------------
-- TABLE STRUCTURE FOR ASSISTANT_CHAT_ITEMS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS";
CREATE TABLE "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "SESSION_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ITEM_TYPE" INT4,
  "CHAT_ID_EXT" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "OPERATE_TYPE" INT4,
  "OPERATE_INFO" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT4,
  "UPDATE_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CHAT_CONTENT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "SUPPORT_STATUS" INT4,
  "TERMINATE_TYPE" INT4,
  "LLM_URL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "LLM_MODEL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "LLM_PARAM" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_FULL_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "NETWORK_SEARCH" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "IS_NETWORK_SEARCH" INT4,
  "TOKEN_COUNT" INT4,
  "CHAR_COUNT" INT4
)
;
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."SESSION_ID" IS '会话ID';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."ITEM_TYPE" IS '记录类型(0:默认 1:问题 2：回答) ';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."CHAT_ID_EXT" IS '关联的记录ID-方便同时删除问题和回答';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."OPERATE_TYPE" IS '操作类型';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."OPERATE_INFO" IS '操作明细';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."DELETE_FLAG" IS '删除状态(0:正常 1:删除) ';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."UPDATE_NAME" IS '更新人名';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."CHAT_CONTENT" IS '聊天内容';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."SUPPORT_STATUS" IS '点赞点踩状态(0:默认 1:点赞 2：点踩) ';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."TERMINATE_TYPE" IS '聊天终止(0:正常 1:终止 2：异常) ';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."LLM_URL" IS '聊天地址';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."LLM_MODEL" IS '聊天模型';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."LLM_PARAM" IS '聊天参数';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."ORG_FULL_NAME" IS '组织全名';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."NETWORK_SEARCH" IS '外网搜索';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."IS_NETWORK_SEARCH" IS '是否外网搜索，1：是，2：否';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."TOKEN_COUNT" IS 'TOKEN计数';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS"."CHAR_COUNT" IS '字符计数';
COMMENT ON TABLE "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS" IS '小智办公-聊天记录表';

-- ----------------------------
-- TABLE STRUCTURE FOR ASSISTANT_SESSION_CHAT_ITEMS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."ASSISTANT_SESSION_CHAT_ITEMS";
CREATE TABLE "KNOWLEDGE"."ASSISTANT_SESSION_CHAT_ITEMS" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "OPERATE_TYPE" INT4,
  "OPERATE_INFO" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT4,
  "UPDATE_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "SUMMARY_TITLE" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "FLAG_TOP" INT4,
  "MODULE" INT2 NOT NULL,
  "DOMAIN_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_SESSION_CHAT_ITEMS"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_SESSION_CHAT_ITEMS"."OPERATE_TYPE" IS '操作类型';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_SESSION_CHAT_ITEMS"."OPERATE_INFO" IS '操作明细';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_SESSION_CHAT_ITEMS"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_SESSION_CHAT_ITEMS"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_SESSION_CHAT_ITEMS"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_SESSION_CHAT_ITEMS"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_SESSION_CHAT_ITEMS"."DELETE_FLAG" IS '删除状态(0:正常 1:删除) ';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_SESSION_CHAT_ITEMS"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_SESSION_CHAT_ITEMS"."UPDATE_NAME" IS '更新人名';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_SESSION_CHAT_ITEMS"."SUMMARY_TITLE" IS '会话标题';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_SESSION_CHAT_ITEMS"."FLAG_TOP" IS '是否置顶：0：默认 1：置顶';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_SESSION_CHAT_ITEMS"."MODULE" IS '模块 1：问答  2：问数  3：问策';
COMMENT ON COLUMN "KNOWLEDGE"."ASSISTANT_SESSION_CHAT_ITEMS"."DOMAIN_ID" IS '领域ID';
COMMENT ON TABLE "KNOWLEDGE"."ASSISTANT_SESSION_CHAT_ITEMS" IS '小智办公-聊天会话表';

-- ----------------------------
-- TABLE STRUCTURE FOR BFM_USER
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."BFM_USER";
CREATE TABLE "KNOWLEDGE"."BFM_USER" (
  "USER_ID" INT8 NOT NULL,
  "USER_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "EMAIL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PHONE" VARCHAR(60) COLLATE "PG_CATALOG"."DEFAULT",
  "USER_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PWD" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ADDRESS" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "MEMO" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "USER_EFF_DATE" TIMESTAMP(6),
  "USER_EXP_DATE" TIMESTAMP(6),
  "CREATED_DATE" TIMESTAMP(6),
  "UPDATE_DATE" TIMESTAMP(6),
  "STATE" CHAR(1) COLLATE "PG_CATALOG"."DEFAULT",
  "STATE_DATE" TIMESTAMP(6),
  "IS_LOCKED" CHAR(1) COLLATE "PG_CATALOG"."DEFAULT",
  "PWD_EXP_DATE" TIMESTAMP(6),
  "LOGIN_FAIL" NUMERIC(6,0),
  "UNLOCK_DATE" TIMESTAMP(6),
  "PORTAL_ID" NUMERIC(6,0),
  "LAN_ID" INT4,
  "SRC_ID" NUMERIC(6,0),
  "OPEN_ID" VARCHAR(120) COLLATE "PG_CATALOG"."DEFAULT",
  "USER_TYPE" CHAR(1) COLLATE "PG_CATALOG"."DEFAULT",
  "ALIAS" VARCHAR(60) COLLATE "PG_CATALOG"."DEFAULT",
  "LAST_LOGIN_DATE" TIMESTAMP(6),
  "SECURITY_QUESTION_ID" NUMERIC(3,0),
  "SECURITY_ANSWER" VARCHAR(120) COLLATE "PG_CATALOG"."DEFAULT",
  "THUMBNAIL_URI" VARCHAR(400) COLLATE "PG_CATALOG"."DEFAULT",
  "EXT_ATTR" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT"
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR BULLETIN_DIGEST
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."BULLETIN_DIGEST";
CREATE TABLE "KNOWLEDGE"."BULLETIN_DIGEST" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "BULLETIN_OUTLINE_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "BULLETIN_DOCUMENT_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "DOCUMENT_TITLE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CHAPTER_OUTLINE_TEXT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "TYPE" INT2,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "CREATE_USER" INT8,
  "UPDATE_USER" INT8,
  "DOCUMENT_RESOURCE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "LABLE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DIGEST"."ID" IS 'ID';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DIGEST"."BULLETIN_OUTLINE_ID" IS '大纲章节ID';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DIGEST"."BULLETIN_DOCUMENT_ID" IS '文章ID';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DIGEST"."DOCUMENT_TITLE" IS '文章标题';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DIGEST"."CHAPTER_OUTLINE_TEXT" IS '章节概要';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DIGEST"."TYPE" IS '1: 所有文章总结总结   2：单个文章总结';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DIGEST"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DIGEST"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DIGEST"."CREATE_USER" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DIGEST"."UPDATE_USER" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DIGEST"."DOCUMENT_RESOURCE" IS '文章来源';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DIGEST"."LABLE" IS '标签  多个标签用“,” 逗号分隔';
COMMENT ON TABLE "KNOWLEDGE"."BULLETIN_DIGEST" IS '大纲-摘要';

-- ----------------------------
-- TABLE STRUCTURE FOR BULLETIN_DOCUMENT
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."BULLETIN_DOCUMENT";
CREATE TABLE "KNOWLEDGE"."BULLETIN_DOCUMENT" (
  "ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "TITLE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "BODY" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "URL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "LABEL" VARCHAR(5000) COLLATE "PG_CATALOG"."DEFAULT",
  "SOURCE_LABEL" VARCHAR(5000) COLLATE "PG_CATALOG"."DEFAULT",
  "AUTHOR" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "FLAG" INT4 DEFAULT 0
)
;
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DOCUMENT"."ID" IS '唯一标识';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DOCUMENT"."TITLE" IS '标题';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DOCUMENT"."BODY" IS '内容';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DOCUMENT"."URL" IS '原文链接';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DOCUMENT"."LABEL" IS '标签，多个以英文逗号分隔';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DOCUMENT"."SOURCE_LABEL" IS '原文标签，多个以英文逗号分隔';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DOCUMENT"."AUTHOR" IS '作者';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DOCUMENT"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DOCUMENT"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DOCUMENT"."FLAG" IS '是否删除 0-否，1-是';
COMMENT ON TABLE "KNOWLEDGE"."BULLETIN_DOCUMENT" IS '简报文章存储';

-- ----------------------------
-- TABLE STRUCTURE FOR BULLETIN_DOCUMENT_INTELLIGENT
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."BULLETIN_DOCUMENT_INTELLIGENT";
CREATE TABLE "KNOWLEDGE"."BULLETIN_DOCUMENT_INTELLIGENT" (
  "INTELLIGENT_BULLETIN_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "BULLETIN_DOCUMENT_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "SCORE" VARCHAR(16) COLLATE "PG_CATALOG"."DEFAULT",
  "TITLE" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "URL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "DESCRIBE" VARCHAR(5000) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DOCUMENT_INTELLIGENT"."INTELLIGENT_BULLETIN_ID" IS '简报ID';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DOCUMENT_INTELLIGENT"."BULLETIN_DOCUMENT_ID" IS '简报文章ID';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DOCUMENT_INTELLIGENT"."SCORE" IS '分数';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DOCUMENT_INTELLIGENT"."TITLE" IS '标题';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DOCUMENT_INTELLIGENT"."URL" IS '文章链接';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_DOCUMENT_INTELLIGENT"."DESCRIBE" IS '文章概要';
COMMENT ON TABLE "KNOWLEDGE"."BULLETIN_DOCUMENT_INTELLIGENT" IS '简报文章分数关联表';

-- ----------------------------
-- TABLE STRUCTURE FOR BULLETIN_GENERATOR_ITEM
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."BULLETIN_GENERATOR_ITEM";
CREATE TABLE "KNOWLEDGE"."BULLETIN_GENERATOR_ITEM" (
  "ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "ITEM_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "INTELLIGENT_BULLETIN_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "GENERATOR_TYPE" INT4,
  "CREATE_TIME" TIMESTAMP(6),
  "CREATE_USER" INT8,
  "DOWNLOAD_URL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "OTHER_CONTENT" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ITEM_STATUS" INT4,
  "UPDATE_TIME" TIMESTAMP(6),
  "TARGET_NUM" INT4,
  "COMPLETED_NUM" INT4,
  "CREATE_USER_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_GENERATOR_ITEM"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_GENERATOR_ITEM"."INTELLIGENT_BULLETIN_ID" IS '简报ID';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_GENERATOR_ITEM"."GENERATOR_TYPE" IS '生成类型：1：WORD，2：PDF';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_GENERATOR_ITEM"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_GENERATOR_ITEM"."CREATE_USER" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_GENERATOR_ITEM"."OTHER_CONTENT" IS '其他内容信息';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_GENERATOR_ITEM"."ITEM_STATUS" IS '记录状态';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_GENERATOR_ITEM"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_GENERATOR_ITEM"."TARGET_NUM" IS '目标数';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_GENERATOR_ITEM"."COMPLETED_NUM" IS '完成数';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_GENERATOR_ITEM"."CREATE_USER_NAME" IS '创建人名称';
COMMENT ON TABLE "KNOWLEDGE"."BULLETIN_GENERATOR_ITEM" IS '简报文档生成记录表';

-- ----------------------------
-- TABLE STRUCTURE FOR BULLETIN_LABLE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."BULLETIN_LABLE";
CREATE TABLE "KNOWLEDGE"."BULLETIN_LABLE" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "TITLE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "DESCRIPTION" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TYPE" INT4,
  "CREATE_TIME" TIMESTAMP(6),
  "INTELLIGENT_BULLETIN_ID" VARCHAR COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_LABLE"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_LABLE"."TITLE_NAME" IS '名称';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_LABLE"."DESCRIPTION" IS '描述';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_LABLE"."TYPE" IS '类型 1：章节  2 ：章节标签';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_LABLE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_LABLE"."INTELLIGENT_BULLETIN_ID" IS '简报ID';
COMMENT ON TABLE "KNOWLEDGE"."BULLETIN_LABLE" IS '章节-标签表';

-- ----------------------------
-- TABLE STRUCTURE FOR BULLETIN_OUTLINE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."BULLETIN_OUTLINE";
CREATE TABLE "KNOWLEDGE"."BULLETIN_OUTLINE" (
  "ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "INTELLIGENT_BULLETIN_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CHAPTER_TITLE" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "CHAPTER_PURPORT" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "CREATE_USER" INT8,
  "UPDATE_USER" INT8,
  "HINT_LABLE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_OUTLINE"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_OUTLINE"."INTELLIGENT_BULLETIN_ID" IS '简报ID';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_OUTLINE"."CHAPTER_TITLE" IS '章节名称';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_OUTLINE"."CHAPTER_PURPORT" IS '章节主旨';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_OUTLINE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_OUTLINE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_OUTLINE"."CREATE_USER" IS '创建用户';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_OUTLINE"."UPDATE_USER" IS '更新用户';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_OUTLINE"."HINT_LABLE" IS '提炼标签，多个标签用“,” 逗号分隔';
COMMENT ON TABLE "KNOWLEDGE"."BULLETIN_OUTLINE" IS '章节-大纲';

-- ----------------------------
-- TABLE STRUCTURE FOR BULLETIN_PROGRESS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."BULLETIN_PROGRESS";
CREATE TABLE "KNOWLEDGE"."BULLETIN_PROGRESS" (
  "ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "INTELLIGENT_BULLETIN_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "STATUS" INT4,
  "TARGET_NUM" INT4 DEFAULT 0,
  "COMPLETED_NUM" INT4 DEFAULT 0,
  "CREATE_TIME" TIMESTAMP(6),
  "OTHER_CONTENT" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_PROGRESS"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_PROGRESS"."INTELLIGENT_BULLETIN_ID" IS '简报ID';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_PROGRESS"."STATUS" IS '进度状态
    START(0,"未开始"),
    INSPECT(1,"文章检索"),
    INSPECT_ING(2,"文章检索进行中"),
    ARRANGE(3,"大纲编排"),
    ARRANGE_ING(4,"大纲编排进行中"),
    GENERATE(5,"摘要生成"),
    GENERATE_ING(6,"摘要生成中"),
    COMPLETE(7,"完成"),';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_PROGRESS"."TARGET_NUM" IS '目标数';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_PROGRESS"."COMPLETED_NUM" IS '完成数';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_PROGRESS"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_PROGRESS"."OTHER_CONTENT" IS '其他内容信息';
COMMENT ON TABLE "KNOWLEDGE"."BULLETIN_PROGRESS" IS '简报生成进度表';

-- ----------------------------
-- TABLE STRUCTURE FOR BULLETIN_PROMPT_TONE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."BULLETIN_PROMPT_TONE";
CREATE TABLE "KNOWLEDGE"."BULLETIN_PROMPT_TONE" (
  "ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "INTELLIGENT_BULLETIN_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TYPE" INT4,
  "CONTENT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "DESCRIPTION" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "INITIAL_CONTENT" TEXT COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_PROMPT_TONE"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_PROMPT_TONE"."INTELLIGENT_BULLETIN_ID" IS '简报ID';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_PROMPT_TONE"."TYPE" IS '类型 ： 1： 分类提示词   2：文章提示词  3：章节概要提示词';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_PROMPT_TONE"."CONTENT" IS '提示词内容';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_PROMPT_TONE"."DESCRIPTION" IS '描述';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_PROMPT_TONE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_PROMPT_TONE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_PROMPT_TONE"."INITIAL_CONTENT" IS '初始值';
COMMENT ON TABLE "KNOWLEDGE"."BULLETIN_PROMPT_TONE" IS '智能简报-提示词优化表';

-- ----------------------------
-- TABLE STRUCTURE FOR BULLETIN_SCORE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."BULLETIN_SCORE";
CREATE TABLE "KNOWLEDGE"."BULLETIN_SCORE" (
  "BULLETIN_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "SCORE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "SCORE_DESC" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "SORT" INT4 DEFAULT 0
)
;
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_SCORE"."BULLETIN_ID" IS '简报ID';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_SCORE"."SCORE" IS '评分标准';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_SCORE"."SCORE_DESC" IS '评分描述';
COMMENT ON COLUMN "KNOWLEDGE"."BULLETIN_SCORE"."SORT" IS '排序';
COMMENT ON TABLE "KNOWLEDGE"."BULLETIN_SCORE" IS '简报评分标准';

-- ----------------------------
-- TABLE STRUCTURE FOR CHAT_DATASET
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."CHAT_DATASET";
CREATE TABLE "KNOWLEDGE"."CHAT_DATASET" (
  "DATASET_ID" INT8 NOT NULL,
  "CHAT_DATASET_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL
)
;
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_DATASET"."DATASET_ID" IS '知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_DATASET"."CHAT_DATASET_ID" IS '问答文件知识库ID';

-- ----------------------------
-- TABLE STRUCTURE FOR CHAT_FILE_INFO
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."CHAT_FILE_INFO";
CREATE TABLE "KNOWLEDGE"."CHAT_FILE_INFO" (
  "I_ID" INT8 NOT NULL,
  "DOC_ID" INT8,
  "APP_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CHAT_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_NAME" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_URL" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_STATE" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_MD" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_LENGTH" INT8,
  "DELETE_FLAG" INT4
)
;
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_FILE_INFO"."I_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_FILE_INFO"."DOC_ID" IS 'DOCCHAIN文件ID';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_FILE_INFO"."APP_ID" IS '智能体ID';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_FILE_INFO"."CHAT_ID" IS '会话ID';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_FILE_INFO"."FILE_NAME" IS '文件名称';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_FILE_INFO"."FILE_URL" IS '文件路径';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_FILE_INFO"."FILE_STATE" IS '文件状态';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_FILE_INFO"."FILE_MD" IS '文件MD信息';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_FILE_INFO"."FILE_LENGTH" IS '文件长度';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_FILE_INFO"."DELETE_FLAG" IS '删除标识';

-- ----------------------------
-- TABLE STRUCTURE FOR CHAT_FILEUPLOAD
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."CHAT_FILEUPLOAD";
CREATE TABLE "KNOWLEDGE"."CHAT_FILEUPLOAD" (
  "ID" INT8 NOT NULL,
  "FILENAME" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_TYPE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "LENGTH" INT8,
  "UPLOAD_DATE" TIMESTAMP(6),
  "CHUNK_SIZE" INT8,
  "CREATE_BY" INT8,
  "TEAM_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6)
)
;
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_FILEUPLOAD"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_FILEUPLOAD"."FILENAME" IS '文件名';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_FILEUPLOAD"."FILE_TYPE" IS '文件类型';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_FILEUPLOAD"."LENGTH" IS '文件大小';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_FILEUPLOAD"."UPLOAD_DATE" IS '上传时间';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_FILEUPLOAD"."CHUNK_SIZE" IS '切块大小';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_FILEUPLOAD"."CREATE_BY" IS '上传用户ID';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_FILEUPLOAD"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_FILEUPLOAD"."UPDATE_TIME" IS '更新时间';
COMMENT ON TABLE "KNOWLEDGE"."CHAT_FILEUPLOAD" IS '文件上传信息表';

-- ----------------------------
-- TABLE STRUCTURE FOR CHAT_ITEMS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."CHAT_ITEMS";
CREATE TABLE "KNOWLEDGE"."CHAT_ITEMS" (
  "ID" INT8 NOT NULL,
  "APP_ID" INT8,
  "CHAT_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CUSTOM_FEEDBACKS" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "DATA_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "OBJ" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "RESPONSE_DATA" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "TEAM_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "TMB_ID" INT8,
  "VALUE" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "USER_GOOD_FEEDBACK" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "ADMIN_FEEDBACK" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "USER_BAD_FEEDBACK" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "V" INT4,
  "USER_EXPECT_ANSWER" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "TOPIC_ID" INT8,
  "CREATE_BY" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "UPDATE_USER" INT8,
  "PLUGIN_DONE" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "SUB_APP_ID" INT8,
  "CHAT_SOURCE" INT4 DEFAULT 0,
  "TERMINATE_TYPE" INT4 DEFAULT 0,
  "DECISION_MSG" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CHAT_ITEMS_EXT_ID" INT8,
  "TOKEN_CNT" INT4,
  "REL_MODEL_ID" INT8,
  "REL_MODEL_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "REL_MODEL_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "DELETE_FLAG" INT4 DEFAULT 0,
  "CHAT_PLATFORM_TYPE" INT4 DEFAULT 0
)
;
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."APP_ID" IS '应用标识';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."CHAT_ID" IS '会话标识';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."CUSTOM_FEEDBACKS" IS '自定义回复';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."DATA_ID" IS 'DATA_ID';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."OBJ" IS '对象类型(人/AI)';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."RESPONSE_DATA" IS '回复内容(JSON)';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."TMB_ID" IS 'TMB_ID';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."USER_GOOD_FEEDBACK" IS '回复好评';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."ADMIN_FEEDBACK" IS 'ADMIN_FEEDBACK';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."USER_EXPECT_ANSWER" IS '用户正确答案';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."UPDATE_USER" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."PLUGIN_DONE" IS '插件的本次会话是否执行完成，0否，1是';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."SUB_APP_ID" IS '子应用标识';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."CHAT_SOURCE" IS '聊天页面来源  0：智能体测试未发布  1：智能体已发布';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."TERMINATE_TYPE" IS '0:正常回答 ，1：终止回答';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."DECISION_MSG" IS '意图识别消息';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."CHAT_ITEMS_EXT_ID" IS '聊天回答-问题 关联ID';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."TOKEN_CNT" IS 'TOKEN大小';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."REL_MODEL_ID" IS '使用的模型ID';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."REL_MODEL_NAME" IS '使用的模型名称';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."REL_MODEL_CODE" IS '使用的模型编码';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."DELETE_FLAG" IS '删除状态：１删除';
COMMENT ON COLUMN "KNOWLEDGE"."CHAT_ITEMS"."CHAT_PLATFORM_TYPE" IS '标识平台调用聊天接口：１：大瓦特APP';
COMMENT ON TABLE "KNOWLEDGE"."CHAT_ITEMS" IS '聊天项';

-- ----------------------------
-- TABLE STRUCTURE FOR CHATS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."CHATS";
CREATE TABLE "KNOWLEDGE"."CHATS" (
  "ID" INT8 NOT NULL,
  "APP_ID" INT8,
  "CHAT_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CONTENT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CUSTOM_TITLE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "SOURCE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "TEAM_ID" INT8,
  "TITLE" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "TMB_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "TOP" BOOL,
  "VARIABLES" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "V" INT4,
  "CREATE_BY" INT8,
  "CHAT_SOURCE" INT4 DEFAULT 0,
  "CREATE_TIME" TIMESTAMP(6) DEFAULT NOW(),
  "DELETE_FLAG" INT4 DEFAULT 0,
  "CHAT_PLATFORM_TYPE" INT4 DEFAULT 0
)
;
COMMENT ON COLUMN "KNOWLEDGE"."CHATS"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."CHATS"."APP_ID" IS '应用标识';
COMMENT ON COLUMN "KNOWLEDGE"."CHATS"."CHAT_ID" IS '会话标识';
COMMENT ON COLUMN "KNOWLEDGE"."CHATS"."CONTENT" IS '会话描述';
COMMENT ON COLUMN "KNOWLEDGE"."CHATS"."CUSTOM_TITLE" IS '会话标题别名';
COMMENT ON COLUMN "KNOWLEDGE"."CHATS"."SOURCE" IS '会话来源';
COMMENT ON COLUMN "KNOWLEDGE"."CHATS"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."CHATS"."TITLE" IS '会话标题';
COMMENT ON COLUMN "KNOWLEDGE"."CHATS"."TMB_ID" IS 'TMB_ID';
COMMENT ON COLUMN "KNOWLEDGE"."CHATS"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."CHATS"."TOP" IS '是否至顶';
COMMENT ON COLUMN "KNOWLEDGE"."CHATS"."VARIABLES" IS '变量';
COMMENT ON COLUMN "KNOWLEDGE"."CHATS"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."CHATS"."CHAT_SOURCE" IS '聊天页面来源  0：智能体未发布  1：智能体已发布';
COMMENT ON COLUMN "KNOWLEDGE"."CHATS"."DELETE_FLAG" IS '删除状态：１删除';
COMMENT ON COLUMN "KNOWLEDGE"."CHATS"."CHAT_PLATFORM_TYPE" IS '标识平台调用聊天接口：１：大瓦特APP，2：大瓦特PC，3：智问';
COMMENT ON TABLE "KNOWLEDGE"."CHATS" IS '聊天会话表';

-- ----------------------------
-- TABLE STRUCTURE FOR CODE_MODEL
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."CODE_MODEL";
CREATE TABLE "KNOWLEDGE"."CODE_MODEL" (
  "ID" INT4 NOT NULL,
  "TYPE" VARCHAR(10) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "CODE_MODE_STR" TEXT COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "RUN_MAIN_STR" VARCHAR(400) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "CREATED_BY" INT4,
  "CREATED_TIME" TIMESTAMP(6),
  "UPDATED_BY" INT4,
  "UPDATED_TIME" TIMESTAMP(6)
)
;
COMMENT ON COLUMN "KNOWLEDGE"."CODE_MODEL"."ID" IS 'ID标识';
COMMENT ON COLUMN "KNOWLEDGE"."CODE_MODEL"."TYPE" IS '执行语言';
COMMENT ON COLUMN "KNOWLEDGE"."CODE_MODEL"."CODE_MODE_STR" IS '代码模版';
COMMENT ON COLUMN "KNOWLEDGE"."CODE_MODEL"."RUN_MAIN_STR" IS '代码执行入口';
COMMENT ON COLUMN "KNOWLEDGE"."CODE_MODEL"."CREATED_BY" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."CODE_MODEL"."CREATED_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."CODE_MODEL"."UPDATED_BY" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."CODE_MODEL"."UPDATED_TIME" IS '更新时间';
COMMENT ON TABLE "KNOWLEDGE"."CODE_MODEL" IS '代码模型表';

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_CHUNK_TERM_REF
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_CHUNK_TERM_REF";
CREATE TABLE "KNOWLEDGE"."DATASET_CHUNK_TERM_REF" (
  "REL_ID" INT8 NOT NULL,
  "TERM_ID" INT8,
  "DATASET_CHUNK_ID" INT8,
  "DATASET_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "TYPE_TERM_ID" VARCHAR COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_ID" INT8,
  "TYPE_TERM_NAME" VARCHAR COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNK_TERM_REF"."REL_ID" IS '关联ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNK_TERM_REF"."TERM_ID" IS '实体ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNK_TERM_REF"."DATASET_CHUNK_ID" IS '关联知识块';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNK_TERM_REF"."DATASET_ID" IS '所属知识库';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNK_TERM_REF"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNK_TERM_REF"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNK_TERM_REF"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNK_TERM_REF"."TYPE_TERM_ID" IS '概念_实体';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNK_TERM_REF"."TYPE_TERM_NAME" IS '概念实体名称';
COMMENT ON TABLE "KNOWLEDGE"."DATASET_CHUNK_TERM_REF" IS '知识分块关联实体';

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_CHUNKS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_CHUNKS";
CREATE TABLE "KNOWLEDGE"."DATASET_CHUNKS" (
  "ID" INT8 NOT NULL,
  "FILES_ID" INT8,
  "CHUNK_TYPE" VARCHAR(16) COLLATE "PG_CATALOG"."DEFAULT",
  "CHUNK_INDEX" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "DATA_STR" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "SYSTEM_NEW_URL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CONVER_DATA" VARCHAR(2000) COLLATE "PG_CATALOG"."DEFAULT",
  "DATA_ID" INT8,
  "DATASET_ID" INT8,
  "TEAM_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "N" INT4,
  "HEADING_CHAIN" VARCHAR(1024) COLLATE "PG_CATALOG"."DEFAULT",
  "DATA_ANS_STR" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "DATA" BYTEA,
  "SUMMARY" VARCHAR(3000) COLLATE "PG_CATALOG"."DEFAULT",
  "VECTOR_DATA" VARCHAR(2) COLLATE "PG_CATALOG"."DEFAULT",
  "P_OBJ_ID" INT8,
  "URL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "BROTHER_CHUNK_ID" INT4,
  "LABEL_STR" TEXT COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNKS"."FILES_ID" IS '所属文件';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNKS"."CHUNK_TYPE" IS '对象类型：TEXT、IMAGE、TABLE';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNKS"."CHUNK_INDEX" IS '对象索引';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNKS"."DATA_STR" IS '文件原文';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNKS"."SYSTEM_NEW_URL" IS '对象文件服务器地址';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNKS"."CONVER_DATA" IS '转换内容';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNKS"."DATA_ID" IS '知识明细标识';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNKS"."DATASET_ID" IS '所属知识库';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNKS"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNKS"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNKS"."N" IS '切割索引(顺序)';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNKS"."HEADING_CHAIN" IS '对象位置';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNKS"."DATA_ANS_STR" IS '辅助原文内容';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNKS"."SUMMARY" IS '摘要';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNKS"."VECTOR_DATA" IS '是否入向量库';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNKS"."P_OBJ_ID" IS '所属父对象';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNKS"."URL" IS 'URL';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNKS"."BROTHER_CHUNK_ID" IS '兄弟分片';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_CHUNKS"."LABEL_STR" IS '标签信息';
COMMENT ON TABLE "KNOWLEDGE"."DATASET_CHUNKS" IS '文件分块明细表';

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_COLLECTION_TERM_REF
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_COLLECTION_TERM_REF";
CREATE TABLE "KNOWLEDGE"."DATASET_COLLECTION_TERM_REF" (
  "REL_ID" INT8 NOT NULL,
  "TERM_ID" INT8,
  "COLLECTION_ID" INT8,
  "DATASET_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6)
)
;
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_COLLECTION_TERM_REF"."REL_ID" IS '关联ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_COLLECTION_TERM_REF"."TERM_ID" IS '实体ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_COLLECTION_TERM_REF"."COLLECTION_ID" IS '关联目录/文件ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_COLLECTION_TERM_REF"."DATASET_ID" IS '所属知识库';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_COLLECTION_TERM_REF"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_COLLECTION_TERM_REF"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_COLLECTION_TERM_REF"."UPDATE_TIME" IS '更新时间';
COMMENT ON TABLE "KNOWLEDGE"."DATASET_COLLECTION_TERM_REF" IS '知识库目录关联实体';

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_COLLECTIONS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_COLLECTIONS";
CREATE TABLE "KNOWLEDGE"."DATASET_COLLECTIONS" (
  "ID" INT8 NOT NULL,
  "CHUNK_SIZE" INT4,
  "CREATE_TIME" TIMESTAMP(6),
  "DATASET_ID" INT8,
  "NAME" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "PARENT_ID" INT8,
  "TEAM_ID" INT8,
  "TMB_ID" INT8,
  "TYPE" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "FILE_ID" INT8,
  "HASH_RAW_TEXT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "QA_PROMPT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "RAW_TEXT_LENGTH" INT4,
  "VER" INT4,
  "TRAINING_TYPE" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "COLLECTION_DESC" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "SEMANTICS_INDEX_NUM" INT8,
  "IS_AQS" INT4
)
;
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_COLLECTIONS"."ID" IS '主键标识';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_COLLECTIONS"."CHUNK_SIZE" IS '切割块大小';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_COLLECTIONS"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_COLLECTIONS"."DATASET_ID" IS '所属知识库';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_COLLECTIONS"."NAME" IS '集合名称';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_COLLECTIONS"."PARENT_ID" IS '父级ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_COLLECTIONS"."TEAM_ID" IS '团队ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_COLLECTIONS"."TMB_ID" IS 'TMB_ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_COLLECTIONS"."TYPE" IS '类型';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_COLLECTIONS"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_COLLECTIONS"."FILE_ID" IS '所属文件';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_COLLECTIONS"."COLLECTION_DESC" IS '目录信息描述';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_COLLECTIONS"."SEMANTICS_INDEX_NUM" IS '语言索引数量';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_COLLECTIONS"."IS_AQS" IS '是否问答对 0：否，1是';
COMMENT ON TABLE "KNOWLEDGE"."DATASET_COLLECTIONS" IS '知识集合';

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_DATA_TABLE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_DATA_TABLE";
CREATE TABLE "KNOWLEDGE"."DATASET_DATA_TABLE" (
  "DATA_TABLE_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "DATA_TABLE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "DATASET_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "DATA_TABLE_CODE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "DATA_TABLE_DESC" VARCHAR(2000) COLLATE "PG_CATALOG"."DEFAULT",
  "DATASOURCE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_DATA_TABLE_FIELD
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_DATA_TABLE_FIELD";
CREATE TABLE "KNOWLEDGE"."DATASET_DATA_TABLE_FIELD" (
  "DATA_TABLE_FIELD_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "FIELD_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "FIELD_CODE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "DATA_TABLE_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "FIELD_UNIT" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "TEAM_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_USER" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "FIELD_DESC" VARCHAR(2000) COLLATE "PG_CATALOG"."DEFAULT",
  "FIELD_TAG" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_DATA_TABLE_REF_TERM
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_DATA_TABLE_REF_TERM";
CREATE TABLE "KNOWLEDGE"."DATASET_DATA_TABLE_REF_TERM" (
  "REL_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "DATA_TABLE_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "TERM_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "DATASET_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "TYPE" INT4,
  "TYPE_TERM_ID" VARCHAR COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATA_TABLE_REF_TERM"."TYPE" IS '1：概念，2：实体';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATA_TABLE_REF_TERM"."TYPE_TERM_ID" IS '概念_实体';

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_DATA_TERM_REF
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_DATA_TERM_REF";
CREATE TABLE "KNOWLEDGE"."DATASET_DATA_TERM_REF" (
  "REL_ID" INT8 NOT NULL,
  "TERM_ID" INT8,
  "DATASET_DATAS_ID" INT8,
  "DATASET_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "TYPE_TERM_ID" VARCHAR COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_ID" INT8,
  "TYPE_TERM_NAME" VARCHAR(2048) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATA_TERM_REF"."REL_ID" IS '关联ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATA_TERM_REF"."TERM_ID" IS '实体ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATA_TERM_REF"."DATASET_DATAS_ID" IS '关联目录ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATA_TERM_REF"."DATASET_ID" IS '所属知识库';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATA_TERM_REF"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATA_TERM_REF"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATA_TERM_REF"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATA_TERM_REF"."TYPE_TERM_ID" IS '概念_实体';
COMMENT ON TABLE "KNOWLEDGE"."DATASET_DATA_TERM_REF" IS '知识明细关联实体';

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_DATAS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_DATAS";
CREATE TABLE "KNOWLEDGE"."DATASET_DATAS" (
  "ID" INT8 NOT NULL,
  "ANS" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "INDEXES" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "INDEX_TYPE" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "CHUNK_INDEX" INT4,
  "COLLECTION_ID" INT8,
  "DATASET_ID" INT8,
  "FILE_ID" INT8,
  "TEAM_ID" INT8,
  "TMB_ID" INT8,
  "FULL_TEXT_TOKEN" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "QUESTION" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "HEADING_CHAIN" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "VER" INT4,
  "UPDATE_TIME" TIMESTAMP(6),
  "CHUNK_TYPE" VARCHAR(10) COLLATE "PG_CATALOG"."DEFAULT",
  "P_OBJ_ID" INT8,
  "P_OBJ_ID_PATH" VARCHAR(3001) COLLATE "PG_CATALOG"."DEFAULT",
  "SUMMARY" VARCHAR(3002) COLLATE "PG_CATALOG"."DEFAULT",
  "TYPE_TERM_IDS" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CHUNK_ID_STR" VARCHAR(3000) COLLATE "PG_CATALOG"."DEFAULT",
  "DOCUMENT_TYPE" INT4
)
;
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATAS"."ID" IS '主键标识';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATAS"."ANS" IS '答案';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATAS"."INDEXES" IS '索引';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATAS"."INDEX_TYPE" IS '索引类型';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATAS"."CHUNK_INDEX" IS '切割索引(顺序)';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATAS"."COLLECTION_ID" IS '所属集合';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATAS"."DATASET_ID" IS '所属知识库';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATAS"."FILE_ID" IS '所属文件';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATAS"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATAS"."TMB_ID" IS '所属团队角色';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATAS"."FULL_TEXT_TOKEN" IS '关键字';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATAS"."QUESTION" IS '问题';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATAS"."HEADING_CHAIN" IS '文件位置';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATAS"."VER" IS '版本';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATAS"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATAS"."CHUNK_TYPE" IS '分片类型';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATAS"."P_OBJ_ID" IS '所属父对象';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATAS"."P_OBJ_ID_PATH" IS '父子层级的PATH路径';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATAS"."SUMMARY" IS '摘要';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATAS"."TYPE_TERM_IDS" IS '概念实体表验证[TEXT]';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATAS"."CHUNK_ID_STR" IS '分片ID,字符串类型是考虑相同问题片段合并';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_DATAS"."DOCUMENT_TYPE" IS '1：文档名称，2：文档摘要，3：目录， 4：目录摘要，5：内容正文';
COMMENT ON TABLE "KNOWLEDGE"."DATASET_DATAS" IS '知识明细表';

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_FILE_DIR
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_FILE_DIR";
CREATE TABLE "KNOWLEDGE"."DATASET_FILE_DIR" (
  "FILE_DIR_ID" INT8 NOT NULL,
  "FILE_ID" INT8,
  "DIR_NAME" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "DIR_PARENT_ID" INT8,
  "DIR_PATH_ID" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "DIR_PATH_CODE" TEXT COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILE_DIR"."FILE_DIR_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILE_DIR"."FILE_ID" IS '文件ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILE_DIR"."DIR_NAME" IS '目录名称';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILE_DIR"."DIR_PARENT_ID" IS '父ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILE_DIR"."DIR_PATH_ID" IS '目录ID路径';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILE_DIR"."DIR_PATH_CODE" IS '目录名称路径';

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_FILE_TERM_REF
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_FILE_TERM_REF";
CREATE TABLE "KNOWLEDGE"."DATASET_FILE_TERM_REF" (
  "REL_ID" INT8 NOT NULL,
  "TERM_ID" INT8,
  "DATASET_FILES_ID" INT8,
  "DATASET_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6)
)
;
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILE_TERM_REF"."REL_ID" IS '关联ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILE_TERM_REF"."TERM_ID" IS '实体ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILE_TERM_REF"."DATASET_FILES_ID" IS '关联文件ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILE_TERM_REF"."DATASET_ID" IS '所属知识库';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILE_TERM_REF"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILE_TERM_REF"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILE_TERM_REF"."UPDATE_TIME" IS '更新时间';
COMMENT ON TABLE "KNOWLEDGE"."DATASET_FILE_TERM_REF" IS '知识库目录关联实体';

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_FILES
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_FILES";
CREATE TABLE "KNOWLEDGE"."DATASET_FILES" (
  "ID" INT8 NOT NULL,
  "FILE_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_TYPE" VARCHAR(16) COLLATE "PG_CATALOG"."DEFAULT",
  "LENGTH" INT8,
  "FILE_MD5" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_URL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPLOAD_DATE" TIMESTAMP(6),
  "CREATE_BY" INT8,
  "TEAM_ID" INT8,
  "DATASET_ID" INT8,
  "FILE_COLLECT_ID" INT8,
  "FILE_SYSTEM_TYPE" VARCHAR(16) COLLATE "PG_CATALOG"."DEFAULT",
  "DOC_ID" INT4,
  "UPLOAD_STATE" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_TYPE_CONVERSION" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_SEGMENTATION" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_SEG_ENHANCE" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_CHUNK_UPLOAD_STATE" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "CHUNK_SIZE" INT8,
  "METADATA" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "THREAD_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CONVERT_FILE_URL" VARCHAR COLLATE "PG_CATALOG"."DEFAULT",
  "CONVERT_FILE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CONTENT_TYPE" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "VECTOR_INDEX_TYPE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "IS_AQS" INT4,
  "CONVERT_PDF" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "SUMMARY" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ORG_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_BY" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "UPDATE_ORG_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CUSTOM_SPLIT_STR" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_USER_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CUSTOM_SPLIT_LENGTH" INT4,
  "HANDLE_TIME" TIMESTAMP(6),
  "COMPLETED_TIME" TIMESTAMP(6),
  "USE_MILVUS" INT4,
  "ERR_MSG" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ERR_STACK" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "COM_DATE" TIMESTAMP(6),
  "FOLDER_ID" INT8 NOT NULL DEFAULT 0,
  "DOC_ID_NEW" INT4,
  "SEGMENT_PARAM" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CUSTOM_SPLIT" INT4
)
;
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."ID" IS '文件ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."FILE_NAME" IS '文件名称';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."FILE_TYPE" IS '文件类型';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."LENGTH" IS '文件长度';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."FILE_MD5" IS '文件MD5';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."FILE_URL" IS '文件上传路径';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."UPLOAD_DATE" IS '上传时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."CREATE_BY" IS '上传用户';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."DATASET_ID" IS '所属知识库';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."FILE_COLLECT_ID" IS '所属目录';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."FILE_SYSTEM_TYPE" IS '文件上传服务器类型 MINIO SSO';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."DOC_ID" IS 'DOCCHAIN文件标识';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."UPLOAD_STATE" IS '文件上传状态';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."FILE_TYPE_CONVERSION" IS '文件转类型状态';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."FILE_SEGMENTATION" IS '文件分割状态';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."FILE_SEG_ENHANCE" IS '文件知识块增强状态';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."FILE_CHUNK_UPLOAD_STATE" IS '文件向量入库状态';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."THREAD_ID" IS '执行线程';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."CONVERT_FILE_URL" IS '上传转化后文件地址';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."CONVERT_FILE_NAME" IS '上传转化后文件名称';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."VECTOR_INDEX_TYPE" IS '构建策略';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."IS_AQS" IS '是否问答对 0：否，1是';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."CONVERT_PDF" IS '是否转PDF';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."SUMMARY" IS '摘要';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."CREATE_ORG_ID" IS '创建人归属组织';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."UPDATE_BY" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."UPDATE_ORG_ID" IS '更新人归属组织';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."CUSTOM_SPLIT_STR" IS '自定义分割字符串';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."UPDATE_USER_NAME" IS '更新人名称';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."CUSTOM_SPLIT_LENGTH" IS '自定义分割字符长度';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."HANDLE_TIME" IS '开始切片时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."COMPLETED_TIME" IS '完成时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."USE_MILVUS" IS '是否使用MILVUS';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."ERR_MSG" IS '异常信息';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."ERR_STACK" IS '异常堆栈';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."COM_DATE" IS '提交切片时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."FOLDER_ID" IS '文件夹ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."DOC_ID_NEW" IS '同步DOCCHAIN,新DOC_ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."SEGMENT_PARAM" IS '切片参数';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FILES"."CUSTOM_SPLIT" IS '是否自定义切片 1是';
COMMENT ON TABLE "KNOWLEDGE"."DATASET_FILES" IS '上传附件记录表';

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_FOLDER
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_FOLDER";
CREATE TABLE "KNOWLEDGE"."DATASET_FOLDER" (
  "ID" INT8 NOT NULL,
  "PARENT_ID" INT8 NOT NULL,
  "DATASET_ID" INT8 NOT NULL,
  "NAME" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "INDEX" INT4 NOT NULL DEFAULT 0,
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 NOT NULL DEFAULT 0,
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "LEVEL" INT4 NOT NULL DEFAULT 0
)
;
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER"."PARENT_ID" IS '父及ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER"."DATASET_ID" IS '知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER"."NAME" IS '名称';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER"."INDEX" IS '排序';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER"."DELETE_FLAG" IS '删除状态(0:正常 1:删除) ';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER"."UPDATE_NAME" IS '更新人名';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER"."LEVEL" IS '深度';
COMMENT ON TABLE "KNOWLEDGE"."DATASET_FOLDER" IS '知识库-目录表';

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_FOLDER_FILE_TAG
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_FOLDER_FILE_TAG";
CREATE TABLE "KNOWLEDGE"."DATASET_FOLDER_FILE_TAG" (
  "ID" INT8 NOT NULL,
  "TYPE" INT4 NOT NULL,
  "TAG_ID" INT8 NOT NULL,
  "REF_ID" INT8 NOT NULL,
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 NOT NULL DEFAULT 0,
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "DATASET_ID" INT8 NOT NULL
)
;
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER_FILE_TAG"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER_FILE_TAG"."TYPE" IS '1文件 2目录';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER_FILE_TAG"."TAG_ID" IS '知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER_FILE_TAG"."REF_ID" IS '文件或目录ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER_FILE_TAG"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER_FILE_TAG"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER_FILE_TAG"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER_FILE_TAG"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER_FILE_TAG"."DELETE_FLAG" IS '删除状态(0:正常 1:删除) ';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER_FILE_TAG"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER_FILE_TAG"."UPDATE_NAME" IS '更新人名';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_FOLDER_FILE_TAG"."DATASET_ID" IS '知识库ID';
COMMENT ON TABLE "KNOWLEDGE"."DATASET_FOLDER_FILE_TAG" IS '知识库-标签关联中间表';

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_IT_QUERY_REL
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_IT_QUERY_REL";
CREATE TABLE "KNOWLEDGE"."DATASET_IT_QUERY_REL" (
  "ID" INT8 NOT NULL,
  "APP_ID" INT8,
  "CHAT_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "CHAT_ITEM_ID" INT8,
  "DATASET_ID" INT8,
  "DATASET_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_USER_ID" INT8,
  "CREATE_USER" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6)
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_IT_QUERY_REL_HISTORY
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_IT_QUERY_REL_HISTORY";
CREATE TABLE "KNOWLEDGE"."DATASET_IT_QUERY_REL_HISTORY" (
  "ID" INT8 NOT NULL,
  "DATA_IT_QUERY_REL_ID" INT8,
  "APP_ID" INT8,
  "CHAT_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CHAT_ITEM_ID" INT8,
  "DATASET_ID" INT8,
  "DATASET_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_USER_ID" INT8,
  "CREATE_USER" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6)
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_LOGOS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_LOGOS";
CREATE TABLE "KNOWLEDGE"."DATASET_LOGOS" (
  "ID" INT8 NOT NULL,
  "DATASET_ID" INT8,
  "STATUS" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_NAME" VARCHAR(3000) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_TYPE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_URL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_SIZE" INT8,
  "FILE_MD5" VARCHAR(3000) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_SYSTEM_TYPE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_BUCKET" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_BY" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATED_TIME" DATE,
  "UPDATE_BY" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" DATE
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_OPERATION_LOG
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_OPERATION_LOG";
CREATE TABLE "KNOWLEDGE"."DATASET_OPERATION_LOG" (
  "ID" INT8 NOT NULL,
  "DATASET_ID" INT8,
  "FILE_ID" INT8,
  "CHUNK_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "OPERATION_TYPE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "CREATED_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "CREATED_ID" INT8,
  "UPDATE_ID" INT8,
  "CREATED_USER_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_USER_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_SHARE_ADD_BAK
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_SHARE_ADD_BAK";
CREATE TABLE "KNOWLEDGE"."DATASET_SHARE_ADD_BAK" (
  "ID" INT8 NOT NULL,
  "DATASET_ID" INT8,
  "DATASET_SHARE_ID" INT8,
  "TYPE" INT2,
  "CREATE_ID" INT8,
  "UPDATE_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 DEFAULT 0,
  "AGENT_TEAM_ID" INT8,
  "USER_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_ADD_BAK"."ID" IS 'ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_ADD_BAK"."DATASET_ID" IS '知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_ADD_BAK"."DATASET_SHARE_ID" IS '知识库分享表ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_ADD_BAK"."TYPE" IS '类型：1:添加到个人 2:添加到团队';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_ADD_BAK"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_ADD_BAK"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_ADD_BAK"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_ADD_BAK"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_ADD_BAK"."DELETE_FLAG" IS '是否删除 1：删除';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_ADD_BAK"."AGENT_TEAM_ID" IS '团队ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_ADD_BAK"."USER_ID" IS '用户ID';
COMMENT ON TABLE "KNOWLEDGE"."DATASET_SHARE_ADD_BAK" IS '知识库共享添加';

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_SHARE_BAK
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_SHARE_BAK";
CREATE TABLE "KNOWLEDGE"."DATASET_SHARE_BAK" (
  "ID" INT8 NOT NULL,
  "DATASET_ID" INT8,
  "ORG_RANGE" INT4 DEFAULT 0,
  "CREATE_ID" INT8,
  "UPDATE_ID" INT8,
  "CREATE_TIME" DATE,
  "UPDATE_TIME" DATE,
  "DELETE_FLAG" INT4 DEFAULT 0,
  "IS_OFFICIAL" INT2 NOT NULL DEFAULT 0,
  "ORG_PROVINCE" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CITY" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "SIZE" INT8 NOT NULL DEFAULT 0
)
;
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_BAK"."ID" IS 'ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_BAK"."DATASET_ID" IS '知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_BAK"."ORG_RANGE" IS '固定范围：1：全网  2：全省 3：全市';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_BAK"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_BAK"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_BAK"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_BAK"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_BAK"."DELETE_FLAG" IS '是否删除 1：删除';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_BAK"."IS_OFFICIAL" IS '是否官方共享 0否 1是';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_BAK"."ORG_PROVINCE" IS '省组织';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_BAK"."ORG_CITY" IS '市组织';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_BAK"."SIZE" IS '知识库大小';
COMMENT ON TABLE "KNOWLEDGE"."DATASET_SHARE_BAK" IS '知识库共享表';

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_SHARE_FAVORITE_BAK
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_SHARE_FAVORITE_BAK";
CREATE TABLE "KNOWLEDGE"."DATASET_SHARE_FAVORITE_BAK" (
  "ID" INT8 NOT NULL,
  "DATASET_ID" INT8 NOT NULL,
  "DATASET_SHARE_ID" INT8 NOT NULL,
  "CREATE_ID" INT8 NOT NULL,
  "UPDATE_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 DEFAULT 0
)
;
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_FAVORITE_BAK"."ID" IS 'ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_FAVORITE_BAK"."DATASET_ID" IS '知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_FAVORITE_BAK"."DATASET_SHARE_ID" IS '知识库分享ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_FAVORITE_BAK"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_FAVORITE_BAK"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_FAVORITE_BAK"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_FAVORITE_BAK"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_FAVORITE_BAK"."DELETE_FLAG" IS '是否删除 1：删除';
COMMENT ON TABLE "KNOWLEDGE"."DATASET_SHARE_FAVORITE_BAK" IS '知识库共享表';

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_SHARE_ITEMS_BAK
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_SHARE_ITEMS_BAK";
CREATE TABLE "KNOWLEDGE"."DATASET_SHARE_ITEMS_BAK" (
  "ID" INT8 NOT NULL,
  "DATASET_ID" INT8,
  "DATASET_SHARE_ID" INT8,
  "TYPE" INT4 DEFAULT 0,
  "AGENT_TEAM_ID" INT8,
  "USER_ACCOUNT" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" INT8,
  "UPDATE_ID" INT8,
  "CREATE_TIME" DATE,
  "UPDATE_TIME" DATE,
  "DELETE_FLAG" INT4 DEFAULT 0
)
;
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_ITEMS_BAK"."ID" IS 'ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_ITEMS_BAK"."DATASET_ID" IS '知识库分享表ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_ITEMS_BAK"."TYPE" IS '指定范围类型：1：团队  2：用户';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_ITEMS_BAK"."AGENT_TEAM_ID" IS '团队ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_ITEMS_BAK"."USER_ACCOUNT" IS '平台账号';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_ITEMS_BAK"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_ITEMS_BAK"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_ITEMS_BAK"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_ITEMS_BAK"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_SHARE_ITEMS_BAK"."DELETE_FLAG" IS '是否删除 1：删除';
COMMENT ON TABLE "KNOWLEDGE"."DATASET_SHARE_ITEMS_BAK" IS '知识库可见范围明细表-指定范围';

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_TAG
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_TAG";
CREATE TABLE "KNOWLEDGE"."DATASET_TAG" (
  "ID" INT8 NOT NULL,
  "DATASET_ID" INT8 NOT NULL,
  "NAME" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 NOT NULL DEFAULT 0,
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_TAG"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_TAG"."DATASET_ID" IS '知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_TAG"."NAME" IS '名称';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_TAG"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_TAG"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_TAG"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_TAG"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_TAG"."DELETE_FLAG" IS '删除状态(0:正常 1:删除) ';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_TAG"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_TAG"."UPDATE_NAME" IS '更新人名';
COMMENT ON TABLE "KNOWLEDGE"."DATASET_TAG" IS '知识库-标签表';

-- ----------------------------
-- TABLE STRUCTURE FOR DATASET_TERM_REF
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASET_TERM_REF";
CREATE TABLE "KNOWLEDGE"."DATASET_TERM_REF" (
  "REL_ID" INT8 NOT NULL,
  "TERM_ID" INT8,
  "DATASET_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6)
)
;
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_TERM_REF"."REL_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_TERM_REF"."TERM_ID" IS '实体ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_TERM_REF"."DATASET_ID" IS '所属知识库';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_TERM_REF"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_TERM_REF"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."DATASET_TERM_REF"."UPDATE_TIME" IS '更新时间';
COMMENT ON TABLE "KNOWLEDGE"."DATASET_TERM_REF" IS '知识库关联实体';

-- ----------------------------
-- TABLE STRUCTURE FOR DATASETS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DATASETS";
CREATE TABLE "KNOWLEDGE"."DATASETS" (
  "ID" INT8 NOT NULL,
  "AGENT_MODEL" VARCHAR(125) COLLATE "PG_CATALOG"."DEFAULT",
  "AVATAR" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "INTRO" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "NAME" VARCHAR(300) COLLATE "PG_CATALOG"."DEFAULT",
  "PARENT_ID" INT8,
  "PERMISSION" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "STATUS" VARCHAR(16) COLLATE "PG_CATALOG"."DEFAULT",
  "TEAM_ID" INT8,
  "TMB_ID" INT8,
  "TYPE" VARCHAR(16) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "VECTOR_MODEL" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "CREATE_USER" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_USER" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "OSS_TYPE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PROJECT_ID" INT8,
  "DIR_ID" INT8,
  "VECTOR_DB_CODE" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "VECTOR_PLUGIN_MACHINE_ID" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "BUILD_MODE" INT4,
  "BUILD_CONFIG" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "BUILD_PLUGIN_ID" INT8,
  "LABEL_CODE" INT8,
  "VECTOR_DB_STATUS" INT2 DEFAULT 0,
  "FILE_TYPE" INT4,
  "EXECUTE_START" INT4 DEFAULT 0,
  "AGENT_TEAM_ID" INT8,
  "SOURCE" INT4 DEFAULT 1,
  "IS_SHARE" INT4 DEFAULT 0,
  "TOPIC_ID" INT4,
  "ACCESS_COUNT" INT8 NOT NULL DEFAULT 0,
  "VECTOR_DATABASE" INT4 DEFAULT NULL::CHARACTER VARYING,
  "ORG_RANGE" INT4
)
;
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."ID" IS '知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."AGENT_MODEL" IS '文件处理模型';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."AVATAR" IS '知识库LOGO';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."INTRO" IS '简介';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."NAME" IS '知识库名称';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."PARENT_ID" IS '上级节点';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."PERMISSION" IS '权限';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."STATUS" IS '状态';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."TMB_ID" IS 'TMB_ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."TYPE" IS '类型';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."VECTOR_MODEL" IS '向量编码模型';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."PROJECT_ID" IS '项目ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."DIR_ID" IS '知识库目录';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."VECTOR_DB_CODE" IS '数据库编码';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."VECTOR_PLUGIN_MACHINE_ID" IS '向量模型编码';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."BUILD_MODE" IS '知识构建方式';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."BUILD_CONFIG" IS '构建配置';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."BUILD_PLUGIN_ID" IS '自定义';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."LABEL_CODE" IS '知识库标签CODE';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."VECTOR_DB_STATUS" IS '向量库创建状态 0-未创建，1-创建';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."FILE_TYPE" IS '文件格式';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."EXECUTE_START" IS '是否启用，0-否，1-是';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."AGENT_TEAM_ID" IS '平台团队ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."SOURCE" IS '来源 1内部 2外部';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."IS_SHARE" IS '是否共享：1：共享';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."TOPIC_ID" IS 'DOCCHAIN主题ID';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."ACCESS_COUNT" IS '访问量';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."VECTOR_DATABASE" IS '向量数据库类型';
COMMENT ON COLUMN "KNOWLEDGE"."DATASETS"."ORG_RANGE" IS '记录共享范围：1：全网  2：全省 3：全市';
COMMENT ON TABLE "KNOWLEDGE"."DATASETS" IS '知识库';

-- ----------------------------
-- TABLE STRUCTURE FOR DC_SYSTEM_CONFIG
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DC_SYSTEM_CONFIG";
CREATE TABLE "KNOWLEDGE"."DC_SYSTEM_CONFIG" (
  "PARAM_ID" INT4,
  "PARAM_CODE" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "PARAM_VALUE" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "PARAM_DESC" VARCHAR(1024) COLLATE "PG_CATALOG"."DEFAULT",
  "PARAM_TYPE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PARAM_GROUP_CODE" VARCHAR(256) COLLATE "PG_CATALOG"."DEFAULT",
  "PARAM_GROUP_NAME" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "PARAM_GROUP_EN_NAME" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "PARAM_SEQ" INT4,
  "PARAM_NAME" VARCHAR(256) COLLATE "PG_CATALOG"."DEFAULT",
  "PARAM_EN_NAME" VARCHAR(256) COLLATE "PG_CATALOG"."DEFAULT",
  "PARAM_TEXT" VARCHAR(256) COLLATE "PG_CATALOG"."DEFAULT"
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR DC_SYSTEM_CONFIG_LIST
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."DC_SYSTEM_CONFIG_LIST";
CREATE TABLE "KNOWLEDGE"."DC_SYSTEM_CONFIG_LIST" (
  "ID" INT8,
  "STAND_CODE" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "STAND_TYPE" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "STAND_DISPLAY_VALUE" VARCHAR(2024) COLLATE "PG_CATALOG"."DEFAULT",
  "STAND_DISPLAY_VALUE_EN" VARCHAR(2024) COLLATE "PG_CATALOG"."DEFAULT",
  "STATE_CD" VARCHAR(3) COLLATE "PG_CATALOG"."DEFAULT",
  "STAND_DESC" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT"
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR EDITING_REVIEW_TERMS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."EDITING_REVIEW_TERMS";
CREATE TABLE "KNOWLEDGE"."EDITING_REVIEW_TERMS" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "STATUS" INT2 DEFAULT 0,
  "TERMS_INFO" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "CREATE_USER" INT8,
  "UPDATE_USER" INT8,
  "TERMS_LABLE_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "QUOTE_FILE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "DW_PATH" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "WORD_PATH" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TERMS_REMARK" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TERMS_EXPAND" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "ADVICE" VARCHAR COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS"."ID" IS 'ID';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS"."STATUS" IS '0:未启用  1：已启用';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS"."TERMS_INFO" IS '条款内容';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS"."CREATE_USER" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS"."UPDATE_USER" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS"."TERMS_LABLE_ID" IS '条款 关联ID';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS"."QUOTE_FILE" IS '引用文件';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS"."DW_PATH" IS '电网平台路径';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS"."WORD_PATH" IS 'WORD目录路径';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS"."TERMS_REMARK" IS '备注';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS"."TERMS_EXPAND" IS '扩编条款';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS"."ADVICE" IS '修改建议';
COMMENT ON TABLE "KNOWLEDGE"."EDITING_REVIEW_TERMS" IS '智能编审条款';

-- ----------------------------
-- TABLE STRUCTURE FOR EDITING_REVIEW_TERMS_CONTENT
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."EDITING_REVIEW_TERMS_CONTENT";
CREATE TABLE "KNOWLEDGE"."EDITING_REVIEW_TERMS_CONTENT" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "PROJECT_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "PROJECT_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CONTENT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "TYPE" INT4,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "VERIFY_RES" INT4,
  "REASON_RES" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "HAS_EXECUTE" INT4,
  "CONTENT_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "PACKAGE_IDS" VARCHAR(1024) COLLATE "PG_CATALOG"."DEFAULT",
  "TENDEROBJECT_IDS" VARCHAR(1024) COLLATE "PG_CATALOG"."DEFAULT",
  "TASK_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT",
  "DATA_PAGE" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT",
  "EXECUTE_RESULT_MSG" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS_CONTENT"."ID" IS 'ID主键';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS_CONTENT"."PROJECT_ID" IS '项目ID';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS_CONTENT"."PROJECT_NAME" IS '项目名称';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS_CONTENT"."CONTENT" IS '内容';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS_CONTENT"."TYPE" IS '1:通用资格要求 2：专用资格要求';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS_CONTENT"."VERIFY_RES" IS '1:符合  2：不符合';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS_CONTENT"."REASON_RES" IS '不符合理由';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS_CONTENT"."HAS_EXECUTE" IS '是否编审过 1：已编审 2：未编审';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS_CONTENT"."CONTENT_ID" IS '内容ID';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS_CONTENT"."PACKAGE_IDS" IS '标包，多个标包用”,“隔开';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS_CONTENT"."TENDEROBJECT_IDS" IS '标的，多个标的用","隔开';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS_CONTENT"."TASK_ID" IS '任务ID';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS_CONTENT"."DATA_FROM" IS '数据来源：非结构化：1  结构化：2 ';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS_CONTENT"."DATA_PAGE" IS '数据内容来源页码';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS_CONTENT"."EXECUTE_RESULT_MSG" IS '编审算法调用结果MSG';

-- ----------------------------
-- TABLE STRUCTURE FOR EDITING_REVIEW_TERMS_EXPAND
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."EDITING_REVIEW_TERMS_EXPAND";
CREATE TABLE "KNOWLEDGE"."EDITING_REVIEW_TERMS_EXPAND" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "TERMS_EXPAND_ITEM" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "TERMS_ID" VARCHAR COLLATE "PG_CATALOG"."DEFAULT",
  "ILLEGAL_REASON" VARCHAR(1024) COLLATE "PG_CATALOG"."DEFAULT",
  "ALTER_ADVICE" VARCHAR(1024) COLLATE "PG_CATALOG"."DEFAULT",
  "HAS_ERROR" INT4
)
;
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS_EXPAND"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS_EXPAND"."TERMS_EXPAND_ITEM" IS '扩编条款';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS_EXPAND"."TERMS_ID" IS '条款ID';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS_EXPAND"."ILLEGAL_REASON" IS '违规原因';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS_EXPAND"."ALTER_ADVICE" IS '修改建议';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS_EXPAND"."HAS_ERROR" IS '1:正例  2 ：反例';

-- ----------------------------
-- TABLE STRUCTURE FOR EDITING_REVIEW_TERMS_LABLE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."EDITING_REVIEW_TERMS_LABLE";
CREATE TABLE "KNOWLEDGE"."EDITING_REVIEW_TERMS_LABLE" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "TERMS_LABLE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS_LABLE"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."EDITING_REVIEW_TERMS_LABLE"."TERMS_LABLE" IS '标签名';

-- ----------------------------
-- TABLE STRUCTURE FOR EMPLOYEES
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."EMPLOYEES";
CREATE TABLE "KNOWLEDGE"."EMPLOYEES" (
  "ID" INT4 NOT NULL,
  "NAME" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "POSITION" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "START_DATE" DATE
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR EVALUATE_FILE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."EVALUATE_FILE";
CREATE TABLE "KNOWLEDGE"."EVALUATE_FILE" (
  "EVALUATE_ID" INT8 NOT NULL,
  "FILE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_TYPE" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "APP_ID" INT8,
  "ACCURACY_RATE" FLOAT8,
  "CREATE_TIME" TIMESTAMP(6),
  "CREATE_BY" INT8,
  "TEAM_ID" INT8,
  "LLM_JUDGES" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "EVALUATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "STATUS" VARCHAR(3) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE"."EVALUATE_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE"."FILE_NAME" IS '文件名称';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE"."FILE_TYPE" IS '文件类型';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE"."APP_ID" IS '应用ID';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE"."ACCURACY_RATE" IS '准确率：准确数除以总数';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE"."TEAM_ID" IS '团队ID';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE"."LLM_JUDGES" IS '大模型ID(AI_MODEL)';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE"."EVALUATE_NAME" IS '评测名称';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE"."STATUS" IS '状态：00B|未处理，00P|文件生成中，00A|文件生成完成，00F|文件生成失败，00X|删除';
COMMENT ON TABLE "KNOWLEDGE"."EVALUATE_FILE" IS '评测文件';

-- ----------------------------
-- TABLE STRUCTURE FOR EVALUATE_FILE_DETAIL
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."EVALUATE_FILE_DETAIL";
CREATE TABLE "KNOWLEDGE"."EVALUATE_FILE_DETAIL" (
  "DETAIL_ID" INT8 NOT NULL,
  "EVALUATE_ID" INT8,
  "SOURCE_QUESTION" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "SOURCE_ANSWER" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "EVA_ANSWER" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "EMBEDDING_SCORE" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "LEVENSHTEIN_SCORE" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "ACCURACY" INT4,
  "COMMENT" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "START_TIME" TIMESTAMP(6),
  "END_TIME" TIMESTAMP(6),
  "COST_TIME" INT4,
  "LLM_JUDGES_RESULT" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "LLM_JUDGES_EXPRESS" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "STATUS" VARCHAR(3) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE_DETAIL"."DETAIL_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE_DETAIL"."EVALUATE_ID" IS '测评文件ID';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE_DETAIL"."SOURCE_QUESTION" IS '原始文件问题';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE_DETAIL"."SOURCE_ANSWER" IS '原始文件答案';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE_DETAIL"."EVA_ANSWER" IS '测评答案';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE_DETAIL"."EMBEDDING_SCORE" IS '语义得分';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE_DETAIL"."LEVENSHTEIN_SCORE" IS '编辑距离得分';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE_DETAIL"."ACCURACY" IS '是否准确：0不准确， 1准确';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE_DETAIL"."COMMENT" IS '备注';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE_DETAIL"."START_TIME" IS '开始时间';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE_DETAIL"."END_TIME" IS '结束时间';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE_DETAIL"."COST_TIME" IS '耗时，单位：秒';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE_DETAIL"."LLM_JUDGES_RESULT" IS '专家评测结果 (1,0,1,1,2):
0,不准确
1,准确
2,不确定
3,异常';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE_DETAIL"."LLM_JUDGES_EXPRESS" IS '专家评测结果总结';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_FILE_DETAIL"."STATUS" IS '状态：00B|未处理，00P|文件生成中，00A|文件生成完成，00F|文件生成失败，00X|删除';
COMMENT ON TABLE "KNOWLEDGE"."EVALUATE_FILE_DETAIL" IS '测评文件详情';

-- ----------------------------
-- TABLE STRUCTURE FOR EVALUATE_LLM_JUDGE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."EVALUATE_LLM_JUDGE";
CREATE TABLE "KNOWLEDGE"."EVALUATE_LLM_JUDGE" (
  "JUDGE_LOG_ID" INT8 NOT NULL,
  "JUDGE_ID" INT8,
  "DETAIL_ID" INT8,
  "LLM_RESULT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "START_TIME" DATE,
  "END_TIME" DATE,
  "COST_TIME" INT4,
  "LLM_RESULT_CODE" INT4,
  "EVALUATE_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_LLM_JUDGE"."JUDGE_LOG_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_LLM_JUDGE"."JUDGE_ID" IS '大模型ID';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_LLM_JUDGE"."DETAIL_ID" IS '评测文档详细内容ID';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_LLM_JUDGE"."LLM_RESULT" IS '大模型问答结果';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_LLM_JUDGE"."START_TIME" IS '开始时间';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_LLM_JUDGE"."END_TIME" IS '结束时间';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_LLM_JUDGE"."COST_TIME" IS '花费时间：单位秒';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_LLM_JUDGE"."LLM_RESULT_CODE" IS '大模型回答结果标准编码：0,不准确，1准确，2，不确定，3,异常';
COMMENT ON COLUMN "KNOWLEDGE"."EVALUATE_LLM_JUDGE"."EVALUATE_ID" IS '评测文件ID';
COMMENT ON TABLE "KNOWLEDGE"."EVALUATE_LLM_JUDGE" IS '大模型评测日志表';

-- ----------------------------
-- TABLE STRUCTURE FOR EXT_CHAT_ITEM
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."EXT_CHAT_ITEM";
CREATE TABLE "KNOWLEDGE"."EXT_CHAT_ITEM" (
  "APP_ID" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "IP_ADDER" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "TITLE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "CONTENT" TEXT COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "START_TIME" TIMESTAMP(0) NOT NULL,
  "USER_AGENT" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "RESP_TIME" TIMESTAMP(6),
  "END_TIME" TIMESTAMP(6),
  "INPUT_TOKENS" INT8,
  "OUTPUT_TOKENS" INT8,
  "RECORD_SOURCE" INT4
)
;
COMMENT ON COLUMN "KNOWLEDGE"."EXT_CHAT_ITEM"."APP_ID" IS '用户ID-凭证ID';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_CHAT_ITEM"."IP_ADDER" IS '访问IP地址';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_CHAT_ITEM"."TITLE" IS '问题';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_CHAT_ITEM"."CONTENT" IS '答案';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_CHAT_ITEM"."START_TIME" IS '请求时间';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_CHAT_ITEM"."USER_AGENT" IS '浏览器请求相关';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_CHAT_ITEM"."RESP_TIME" IS '响应时间 大模型第一次回复时间';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_CHAT_ITEM"."END_TIME" IS '请求结束时间';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_CHAT_ITEM"."INPUT_TOKENS" IS '输入TOKENS数量';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_CHAT_ITEM"."OUTPUT_TOKENS" IS '输出TOKENS数量';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_CHAT_ITEM"."RECORD_SOURCE" IS '来源记录 1-单纯模型调用统计，2-智能体对外聊天接口统计';

-- ----------------------------
-- TABLE STRUCTURE FOR EXT_INTERFACE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."EXT_INTERFACE";
CREATE TABLE "KNOWLEDGE"."EXT_INTERFACE" (
  "ID" INT8 NOT NULL,
  "PARENT_ID" INT8,
  "URL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "REMARK" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "USER_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6)
)
;
COMMENT ON COLUMN "KNOWLEDGE"."EXT_INTERFACE"."ID" IS '接口ID';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_INTERFACE"."PARENT_ID" IS '接口父ID';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_INTERFACE"."URL" IS '接口路径';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_INTERFACE"."NAME" IS '接口名称';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_INTERFACE"."REMARK" IS '接口备注';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_INTERFACE"."USER_ID" IS '用户ID';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_INTERFACE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_INTERFACE"."UPDATE_TIME" IS '更新时间';
COMMENT ON TABLE "KNOWLEDGE"."EXT_INTERFACE" IS '开放平台接口表';

-- ----------------------------
-- TABLE STRUCTURE FOR EXT_SECRET
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."EXT_SECRET";
CREATE TABLE "KNOWLEDGE"."EXT_SECRET" (
  "ID" INT8 NOT NULL,
  "APP_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "SECRET_KEY" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "EXPIRY_DATE" TIMESTAMP(6),
  "ENCRYPTION" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "LATELY_TIME" TIMESTAMP(6),
  "USER_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."EXT_SECRET"."ID" IS '秘钥表ID';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_SECRET"."APP_ID" IS '用户APP_ID';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_SECRET"."SECRET_KEY" IS '用户生成秘钥';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_SECRET"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_SECRET"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_SECRET"."EXPIRY_DATE" IS '过期时间';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_SECRET"."ENCRYPTION" IS '加密串';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_SECRET"."NAME" IS '名字';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_SECRET"."LATELY_TIME" IS '最近使用时间';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_SECRET"."USER_ID" IS '用户ID';
COMMENT ON TABLE "KNOWLEDGE"."EXT_SECRET" IS '开放平台用户秘钥表';

-- ----------------------------
-- TABLE STRUCTURE FOR EXT_SECRET_INTERFACE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."EXT_SECRET_INTERFACE";
CREATE TABLE "KNOWLEDGE"."EXT_SECRET_INTERFACE" (
  "SECRET_KEY_ID" INT8 NOT NULL,
  "INTERFACE_ID" INT8 NOT NULL
)
;
COMMENT ON COLUMN "KNOWLEDGE"."EXT_SECRET_INTERFACE"."SECRET_KEY_ID" IS '秘钥表ID';
COMMENT ON COLUMN "KNOWLEDGE"."EXT_SECRET_INTERFACE"."INTERFACE_ID" IS '接口ID';
COMMENT ON TABLE "KNOWLEDGE"."EXT_SECRET_INTERFACE" IS '开放平台秘钥接口关联表';

-- ----------------------------
-- TABLE STRUCTURE FOR FILE_CONTENT_INFO
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."FILE_CONTENT_INFO";
CREATE TABLE "KNOWLEDGE"."FILE_CONTENT_INFO" (
  "CONTENT_ID" INT8 NOT NULL,
  "FILE_ID" INT8,
  "CONTENT_TYPE" VARCHAR COLLATE "PG_CATALOG"."DEFAULT",
  "CONTENT" TEXT COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."FILE_CONTENT_INFO"."CONTENT_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_CONTENT_INFO"."FILE_ID" IS '文件ID';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_CONTENT_INFO"."CONTENT_TYPE" IS '文件内容类型：MD,PDF';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_CONTENT_INFO"."CONTENT" IS '内容';
COMMENT ON TABLE "KNOWLEDGE"."FILE_CONTENT_INFO" IS '文件内容';

-- ----------------------------
-- TABLE STRUCTURE FOR FILE_SEGMENT_INFO
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."FILE_SEGMENT_INFO";
CREATE TABLE "KNOWLEDGE"."FILE_SEGMENT_INFO" (
  "FILE_ID" INT8 NOT NULL,
  "FILE_SEG_STATE" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "COM_DATE" TIMESTAMP(6),
  "HANDLE_DATE" TIMESTAMP(6),
  "INPUT_PARAM" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "PRIORITY_PROCESS" INT4,
  "DATASET_ID" INT8,
  "DATASET_SOURCE" INT4,
  "COM_USER_ID" INT8,
  "COM_USER_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PRIORITY_DATE" TIMESTAMP(6)
)
;
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_INFO"."FILE_ID" IS '文件ID';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_INFO"."FILE_SEG_STATE" IS '文件状态：等待，处理中';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_INFO"."COM_DATE" IS '提交时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_INFO"."HANDLE_DATE" IS '开始处理时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_INFO"."INPUT_PARAM" IS '入参';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_INFO"."PRIORITY_PROCESS" IS '是否优先处理：1 是';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_INFO"."DATASET_ID" IS '知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_INFO"."DATASET_SOURCE" IS '知识库类型';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_INFO"."COM_USER_ID" IS '提交人ID';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_INFO"."COM_USER_NAME" IS '提交人名称';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_INFO"."PRIORITY_DATE" IS '设置优先处理时间';

-- ----------------------------
-- TABLE STRUCTURE FOR FILE_SEGMENT_INFO_COPY1
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."FILE_SEGMENT_INFO_COPY1";
CREATE TABLE "KNOWLEDGE"."FILE_SEGMENT_INFO_COPY1" (
  "FILE_ID" INT8 NOT NULL,
  "FILE_SEG_STATE" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "COM_DATE" TIMESTAMP(6),
  "HANDLE_DATE" TIMESTAMP(6),
  "INPUT_PARAM" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "PRIORITY_PROCESS" INT4,
  "DATASET_ID" INT8,
  "DATASET_SOURCE" INT4,
  "COM_USER_ID" INT8,
  "COM_USER_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PRIORITY_DATE" TIMESTAMP(6)
)
;
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_INFO_COPY1"."FILE_ID" IS '文件ID';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_INFO_COPY1"."FILE_SEG_STATE" IS '文件状态：等待，处理中';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_INFO_COPY1"."COM_DATE" IS '提交时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_INFO_COPY1"."HANDLE_DATE" IS '开始处理时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_INFO_COPY1"."INPUT_PARAM" IS '入参';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_INFO_COPY1"."PRIORITY_PROCESS" IS '是否优先处理：1 是';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_INFO_COPY1"."DATASET_ID" IS '知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_INFO_COPY1"."DATASET_SOURCE" IS '知识库类型';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_INFO_COPY1"."COM_USER_ID" IS '提交人ID';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_INFO_COPY1"."COM_USER_NAME" IS '提交人名称';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_INFO_COPY1"."PRIORITY_DATE" IS '设置优先处理时间';

-- ----------------------------
-- TABLE STRUCTURE FOR FILE_SEGMENT_STATE_INFO
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."FILE_SEGMENT_STATE_INFO";
CREATE TABLE "KNOWLEDGE"."FILE_SEGMENT_STATE_INFO" (
  "ID" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "FILE_ID" INT8 NOT NULL,
  "FILE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "DATASET_ID" INT8 NOT NULL,
  "CREATE_TIME" TIMESTAMP(6),
  "EXEC_STATE" INT4,
  "DOC_ID" INT4
)
;
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_STATE_INFO"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_STATE_INFO"."FILE_ID" IS '文件ID';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_STATE_INFO"."FILE_NAME" IS '文件名称';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_STATE_INFO"."DATASET_ID" IS '知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_STATE_INFO"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_STATE_INFO"."EXEC_STATE" IS '执行状态：1 未切片完成 2已切片完成，正在获取分片数据等';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SEGMENT_STATE_INFO"."DOC_ID" IS 'DOCCHAIN文档ID';

-- ----------------------------
-- TABLE STRUCTURE FOR FILE_SPLIT_COST
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."FILE_SPLIT_COST";
CREATE TABLE "KNOWLEDGE"."FILE_SPLIT_COST" (
  "COST_ID" INT8 NOT NULL,
  "FILE_ID" INT8,
  "DOC_ID" INT8,
  "FILE_TYPE" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_NAME" VARCHAR(3000) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_SIZE" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "IMAGE_NUM" INT4,
  "TABLE_NUM" INT4,
  "CONVERT_PDF_START" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CONVERT_PDF_END" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CONVERT_PDF_COST" INT8,
  "CONVERT_MD_START" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CONVERT_MD_END" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CONVERT_MD_COST" INT8,
  "SPLIT_MD_START" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "SPLIT_MD_END" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "SPLIT_MD_COST" INT8,
  "SUMMARY_START" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "SUMMARY_END" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "SUMMARY_COST" INT8,
  "TOTAL_COST" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SPLIT_COST"."COST_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SPLIT_COST"."FILE_ID" IS '所属文件';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SPLIT_COST"."DOC_ID" IS '拆分文件标识';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SPLIT_COST"."FILE_TYPE" IS '文件类型';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SPLIT_COST"."FILE_NAME" IS '文件名称';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SPLIT_COST"."FILE_SIZE" IS '文件大小';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SPLIT_COST"."IMAGE_NUM" IS '图片个数';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SPLIT_COST"."TABLE_NUM" IS '表格个数';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SPLIT_COST"."CONVERT_PDF_START" IS '转PDF开始时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SPLIT_COST"."CONVERT_PDF_END" IS '转PDF结束时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SPLIT_COST"."CONVERT_PDF_COST" IS '转PDF花费时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SPLIT_COST"."CONVERT_MD_START" IS '转MD开始时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SPLIT_COST"."CONVERT_MD_END" IS '转MD结束时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SPLIT_COST"."CONVERT_MD_COST" IS '转MD花费时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SPLIT_COST"."SPLIT_MD_START" IS '切分MD开始时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SPLIT_COST"."SPLIT_MD_END" IS '切分MD结束时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SPLIT_COST"."SPLIT_MD_COST" IS '切分MD花费时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SPLIT_COST"."SUMMARY_START" IS '提取摘要开始时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SPLIT_COST"."SUMMARY_END" IS '提取摘要结束时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SPLIT_COST"."SUMMARY_COST" IS '提取摘要花费时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_SPLIT_COST"."TOTAL_COST" IS '文件拆分花费时间';
COMMENT ON TABLE "KNOWLEDGE"."FILE_SPLIT_COST" IS '文件拆分消耗时间';

-- ----------------------------
-- TABLE STRUCTURE FOR FILE_TASK_INST
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."FILE_TASK_INST";
CREATE TABLE "KNOWLEDGE"."FILE_TASK_INST" (
  "I_ID" INT8 NOT NULL,
  "FILE_ID" INT8,
  "TASK_INST_NO" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "REL_CREAT_FLOW_ID" INT8,
  "THREAD_ID" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "BATCH_NUMBER" VARCHAR COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TASK_INST"."I_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TASK_INST"."FILE_ID" IS '文件ID';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TASK_INST"."TASK_INST_NO" IS '任务实例编号';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TASK_INST"."REL_CREAT_FLOW_ID" IS '关联构建流程';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TASK_INST"."THREAD_ID" IS '文件处理线程ID';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TASK_INST"."BATCH_NUMBER" IS '批次号';
COMMENT ON TABLE "KNOWLEDGE"."FILE_TASK_INST" IS '文件任务实例';

-- ----------------------------
-- TABLE STRUCTURE FOR FILE_TPL_CONTENT_CATALOG
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."FILE_TPL_CONTENT_CATALOG";
CREATE TABLE "KNOWLEDGE"."FILE_TPL_CONTENT_CATALOG" (
  "FILE_TPL_COTENT_CATE_ID" INT8,
  "TYPE" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "LEVEL" INT4,
  "TPL_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PARENT_ID" INT8,
  "CREATE_BY" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "STATUS" VARCHAR(3) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_CONTENT_CATALOG"."FILE_TPL_COTENT_CATE_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_CONTENT_CATALOG"."TYPE" IS '类型';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_CONTENT_CATALOG"."LEVEL" IS '层级';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_CONTENT_CATALOG"."TPL_NAME" IS '名称';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_CONTENT_CATALOG"."PARENT_ID" IS '父级';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_CONTENT_CATALOG"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_CONTENT_CATALOG"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_CONTENT_CATALOG"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_CONTENT_CATALOG"."UPDATE_TIME" IS '更新时间';
COMMENT ON TABLE "KNOWLEDGE"."FILE_TPL_CONTENT_CATALOG" IS '文件模板内容目录';

-- ----------------------------
-- TABLE STRUCTURE FOR FILE_TPL_CONTENT_FEATURE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."FILE_TPL_CONTENT_FEATURE";
CREATE TABLE "KNOWLEDGE"."FILE_TPL_CONTENT_FEATURE" (
  "CREAT_FLOW_ID" INT8 NOT NULL,
  "TYPE" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "REL_FILE_TPL_COTENT_CATE_ID" INT8,
  "REL_TERM_TYPE_ID" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "TERMS" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_BY" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6)
)
;
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_CONTENT_FEATURE"."CREAT_FLOW_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_CONTENT_FEATURE"."TYPE" IS '类型';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_CONTENT_FEATURE"."REL_FILE_TPL_COTENT_CATE_ID" IS '引用目录';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_CONTENT_FEATURE"."REL_TERM_TYPE_ID" IS '引用概念';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_CONTENT_FEATURE"."TERMS" IS '实体样例';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_CONTENT_FEATURE"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_CONTENT_FEATURE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_CONTENT_FEATURE"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_CONTENT_FEATURE"."UPDATE_TIME" IS '更新时间';
COMMENT ON TABLE "KNOWLEDGE"."FILE_TPL_CONTENT_FEATURE" IS '文件内容特征';

-- ----------------------------
-- TABLE STRUCTURE FOR FILE_TPL_FEATURE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."FILE_TPL_FEATURE";
CREATE TABLE "KNOWLEDGE"."FILE_TPL_FEATURE" (
  "CREAT_FLOW_ID" INT8 NOT NULL,
  "TYPE" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "REL_FILE_TPL_COTENT_CATE_ID" INT8,
  "LEVEL" INT4,
  "NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PARENT_ID" INT8,
  "COMPARE_REL" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "COMPARE_VAL" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_BY" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "STATUS" VARCHAR(3) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_FEATURE"."CREAT_FLOW_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_FEATURE"."TYPE" IS '类型';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_FEATURE"."REL_FILE_TPL_COTENT_CATE_ID" IS '引用目录';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_FEATURE"."LEVEL" IS '层级';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_FEATURE"."NAME" IS '名称';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_FEATURE"."PARENT_ID" IS '父级名称';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_FEATURE"."COMPARE_REL" IS '比较关系';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_FEATURE"."COMPARE_VAL" IS '比较值';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_FEATURE"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_FEATURE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_FEATURE"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_FEATURE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_FEATURE"."STATUS" IS '是否启用';
COMMENT ON TABLE "KNOWLEDGE"."FILE_TPL_FEATURE" IS '文件模板特征';

-- ----------------------------
-- TABLE STRUCTURE FOR FILE_TPL_MAN
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."FILE_TPL_MAN";
CREATE TABLE "KNOWLEDGE"."FILE_TPL_MAN" (
  "FILE_TPL_ID" INT8 NOT NULL,
  "TPL_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_URL" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_BY" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "STATUS" VARCHAR(3) COLLATE "PG_CATALOG"."DEFAULT",
  "DATASET_ID" INT8,
  "CATALOG_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_MAN"."FILE_TPL_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_MAN"."TPL_NAME" IS '名称';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_MAN"."FILE_URL" IS '样例附件地址';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_MAN"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_MAN"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_MAN"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_MAN"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_MAN"."STATUS" IS '是否启用';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_MAN"."DATASET_ID" IS '所属知识库';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_MAN"."CATALOG_ID" IS '模板目录ID';
COMMENT ON TABLE "KNOWLEDGE"."FILE_TPL_MAN" IS '文件模板管理';

-- ----------------------------
-- TABLE STRUCTURE FOR FILE_TPL_MAN_CATALOG
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."FILE_TPL_MAN_CATALOG";
CREATE TABLE "KNOWLEDGE"."FILE_TPL_MAN_CATALOG" (
  "I_ID" INT8 NOT NULL,
  "NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PARENT_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "PATH" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_MAN_CATALOG"."I_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_MAN_CATALOG"."NAME" IS '目录名称';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_MAN_CATALOG"."PARENT_ID" IS '父级';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_MAN_CATALOG"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_MAN_CATALOG"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_MAN_CATALOG"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_TPL_MAN_CATALOG"."PATH" IS 'ID路径';
COMMENT ON TABLE "KNOWLEDGE"."FILE_TPL_MAN_CATALOG" IS '文件模板分类';

-- ----------------------------
-- TABLE STRUCTURE FOR FILE_UPLOAD_RECORD
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."FILE_UPLOAD_RECORD";
CREATE TABLE "KNOWLEDGE"."FILE_UPLOAD_RECORD" (
  "ID" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "FILE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_SIZE" INT8,
  "FILE_TYPE" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "BUCKET_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "OBJECT_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPLOAD_STATUS" INT2
)
;
COMMENT ON COLUMN "KNOWLEDGE"."FILE_UPLOAD_RECORD"."ID" IS '主键ID
';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_UPLOAD_RECORD"."FILE_NAME" IS '文件名字';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_UPLOAD_RECORD"."FILE_SIZE" IS '文件大小';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_UPLOAD_RECORD"."FILE_TYPE" IS '文件类型';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_UPLOAD_RECORD"."BUCKET_NAME" IS '文件所在桶';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_UPLOAD_RECORD"."OBJECT_NAME" IS '文件所在完整路径';
COMMENT ON COLUMN "KNOWLEDGE"."FILE_UPLOAD_RECORD"."UPLOAD_STATUS" IS '文件上传状态(0:上传中，1：上传成功，2：上传失败)';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_BUSINESS_DOMAIN_UPDATE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_BUSINESS_DOMAIN_UPDATE";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_BUSINESS_DOMAIN_UPDATE" (
  "ID" INT8 NOT NULL,
  "EXT_ID" INT8,
  "EXT_TYPE" INT4 DEFAULT 0,
  "IS_UPDATE" INT4 NOT NULL DEFAULT 0,
  "ORIGINAL_CODE" INT4,
  "ORIGINAL_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT4 DEFAULT 0
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_BUSINESS_DOMAIN_UPDATE"."ID" IS 'ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_BUSINESS_DOMAIN_UPDATE"."EXT_ID" IS '关联ID ';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_BUSINESS_DOMAIN_UPDATE"."EXT_TYPE" IS '关联类型：1：知识库  2：插件 3：工作流';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_BUSINESS_DOMAIN_UPDATE"."IS_UPDATE" IS '是否修改 0否 1是';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_BUSINESS_DOMAIN_UPDATE"."ORIGINAL_CODE" IS '原始CODE';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_BUSINESS_DOMAIN_UPDATE"."ORIGINAL_NAME" IS '原始业务域名';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_BUSINESS_DOMAIN_UPDATE"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_BUSINESS_DOMAIN_UPDATE"."ORG_CODE" IS '组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_BUSINESS_DOMAIN_UPDATE"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_BUSINESS_DOMAIN_UPDATE"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_BUSINESS_DOMAIN_UPDATE"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_BUSINESS_DOMAIN_UPDATE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_BUSINESS_DOMAIN_UPDATE"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_BUSINESS_DOMAIN_UPDATE"."UPDATE_NAME" IS '更新人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_BUSINESS_DOMAIN_UPDATE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_BUSINESS_DOMAIN_UPDATE"."DELETE_FLAG" IS '删除状态(0:正常 1:删除)';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_DATASET_AUDIT
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT" (
  "ID" INT8 NOT NULL,
  "DATASET_ID" INT8,
  "CURRENT_STATUS" INT4 DEFAULT 0,
  "CURRENT_AUDIT_INFO" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "ENTER_TIME" TIMESTAMP(6),
  "CREATE_ID" INT8,
  "UPDATE_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT4 DEFAULT 0,
  "ORG_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT"."ID" IS 'ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT"."DATASET_ID" IS '知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT"."CURRENT_STATUS" IS '当前状态 ,当前状态  0：待审核 1：审核中 2：审核失败 3：审核通过 4：审核取消';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT"."CURRENT_AUDIT_INFO" IS '当前审批信息';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT"."ENTER_TIME" IS '进入审批时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT"."CREATE_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT"."UPDATE_ID" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT"."DELETE_FLAG" IS '删除状态 1：删除';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT"."ORG_CODE" IS '组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT"."UPDATE_NAME" IS '更新人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT"."CREATE_NAME" IS '创建人名称';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_DATASET_AUDIT_RECORD
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT_RECORD";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT_RECORD" (
  "ID" INT8 NOT NULL,
  "DATASET_ID" INT8,
  "AUDIT_ID" INT8,
  "STATUS" INT4 DEFAULT 0,
  "AUDIT_INFO" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" INT8,
  "UPDATE_ID" INT8,
  "CREATE_TIME" TIMESTAMP(0),
  "UPDATE_TIME" TIMESTAMP(0),
  "DELETE_FLAG" INT4 DEFAULT 0,
  "ORG_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT_RECORD"."ID" IS 'ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT_RECORD"."DATASET_ID" IS '知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT_RECORD"."AUDIT_ID" IS '审批ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT_RECORD"."STATUS" IS '当前状态  0：待审核 1：审核中 2：审核失败 3：审核通过 4：审核取消';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT_RECORD"."AUDIT_INFO" IS '审核信息';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT_RECORD"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT_RECORD"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT_RECORD"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT_RECORD"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT_RECORD"."DELETE_FLAG" IS '是否删除 1：删除';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT_RECORD"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT_RECORD"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT_RECORD"."ORG_CODE" IS '组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT_RECORD"."UPDATE_NAME" IS '更新人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT_RECORD"."CREATE_NAME" IS '创建人名称';
COMMENT ON TABLE "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT_RECORD" IS '知识库-审批记录';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_DATASET_SHARE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE" (
  "ID" INT8 NOT NULL,
  "DATASET_ID" INT8,
  "ORG_RANGE" INT4 DEFAULT 0,
  "IS_OFFICIAL" INT2 NOT NULL DEFAULT 0,
  "ORG_PROVINCE" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CITY" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "DATASET_SIZE" INT8 NOT NULL DEFAULT 0,
  "ORG_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 DEFAULT 0,
  "AUDIT_STATUS" INT4
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE"."ID" IS 'ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE"."DATASET_ID" IS '知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE"."ORG_RANGE" IS '固定范围：1：全网  2：全省 3：全市';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE"."IS_OFFICIAL" IS '是否官方共享 0否 1是';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE"."ORG_PROVINCE" IS '省组织';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE"."ORG_CITY" IS '市组织';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE"."DATASET_SIZE" IS '知识库大小';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE"."ORG_CODE" IS '组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE"."UPDATE_NAME" IS '更新人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE"."DELETE_FLAG" IS '删除状态(0:正常 1:删除)';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE"."AUDIT_STATUS" IS '当前审批状态';
COMMENT ON TABLE "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE" IS '知识库共享表';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_DATASET_SHARE_ADD
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ADD";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ADD" (
  "ID" INT8 NOT NULL,
  "DATASET_ID" INT8 NOT NULL,
  "DATASET_SHARE_ID" INT8,
  "ADD_TYPE" INT2 NOT NULL,
  "AGENT_TEAM_ID" INT8 NOT NULL,
  "USER_ID" INT8 NOT NULL,
  "ORG_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 DEFAULT 0
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ADD"."ID" IS 'ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ADD"."DATASET_ID" IS '知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ADD"."DATASET_SHARE_ID" IS '知识库分享表ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ADD"."ADD_TYPE" IS '类型：1:添加到个人 2:添加到团队';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ADD"."AGENT_TEAM_ID" IS '团队ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ADD"."USER_ID" IS '用户ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ADD"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ADD"."ORG_CODE" IS '组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ADD"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ADD"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ADD"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ADD"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ADD"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ADD"."UPDATE_NAME" IS '更新人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ADD"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ADD"."DELETE_FLAG" IS '删除状态(0:正常 1:删除)';
COMMENT ON TABLE "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ADD" IS '知识库共享添加';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_DATASET_SHARE_FAVORITE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_FAVORITE";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_FAVORITE" (
  "ID" INT8 NOT NULL,
  "DATASET_ID" INT8 NOT NULL,
  "DATASET_SHARE_ID" INT8 NOT NULL,
  "ORG_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 DEFAULT 0
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_FAVORITE"."ID" IS 'ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_FAVORITE"."DATASET_ID" IS '知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_FAVORITE"."DATASET_SHARE_ID" IS '知识库分享ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_FAVORITE"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_FAVORITE"."ORG_CODE" IS '组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_FAVORITE"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_FAVORITE"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_FAVORITE"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_FAVORITE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_FAVORITE"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_FAVORITE"."UPDATE_NAME" IS '更新人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_FAVORITE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_FAVORITE"."DELETE_FLAG" IS '删除状态(0:正常 1:删除)';
COMMENT ON TABLE "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_FAVORITE" IS '知识库共享表';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_DATASET_SHARE_ITEMS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ITEMS";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ITEMS" (
  "ID" INT8 NOT NULL,
  "DATASET_ID" INT8,
  "DATASET_SHARE_ID" INT8,
  "SHARE_TYPE" INT2 DEFAULT 0,
  "AGENT_TEAM_ID" INT8,
  "USER_ACCOUNT" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 DEFAULT 0
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ITEMS"."ID" IS 'ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ITEMS"."DATASET_ID" IS '知识库分享表ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ITEMS"."SHARE_TYPE" IS '指定范围类型：1：个人  2：团队';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ITEMS"."AGENT_TEAM_ID" IS '团队ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ITEMS"."USER_ACCOUNT" IS '平台账号';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ITEMS"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ITEMS"."ORG_CODE" IS '组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ITEMS"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ITEMS"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ITEMS"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ITEMS"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ITEMS"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ITEMS"."UPDATE_NAME" IS '更新人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ITEMS"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ITEMS"."DELETE_FLAG" IS '删除状态(0:正常 1:删除)';
COMMENT ON TABLE "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ITEMS" IS '知识库可见范围明细表-指定范围';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_DATASETS_INVOKING_LOG
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_DATASETS_INVOKING_LOG";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_DATASETS_INVOKING_LOG" (
  "ID" INT8 NOT NULL,
  "OPERATION_ID" INT8,
  "OPERATION_TYPE" INT4,
  "ORG_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 DEFAULT 0,
  "DATASET_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASETS_INVOKING_LOG"."ID" IS '主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASETS_INVOKING_LOG"."OPERATION_ID" IS '智能体ID/工作流ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASETS_INVOKING_LOG"."OPERATION_TYPE" IS '调用类型:1:智能体，2工作流';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASETS_INVOKING_LOG"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASETS_INVOKING_LOG"."ORG_CODE" IS '组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASETS_INVOKING_LOG"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASETS_INVOKING_LOG"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASETS_INVOKING_LOG"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASETS_INVOKING_LOG"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASETS_INVOKING_LOG"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASETS_INVOKING_LOG"."UPDATE_NAME" IS '更新人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASETS_INVOKING_LOG"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASETS_INVOKING_LOG"."DELETE_FLAG" IS '删除状态(0:正常 1:删除)';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_DATASETS_INVOKING_LOG"."DATASET_ID" IS '知识库ID';
COMMENT ON TABLE "KNOWLEDGE"."GAIXC_AGENT_DATASETS_INVOKING_LOG" IS '知识库调用记录';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_GDAICO_CALL
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_GDAICO_CALL";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_GDAICO_CALL" (
  "ID" INT8 NOT NULL,
  "USER_ACCOUNT" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "CALL_TIME" TIMESTAMP(6),
  "AGENT_ID" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "TITLE" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "BRIEF" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "USER_NAME" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "UPDATE_TIME" TIMESTAMP(6),
  "ORG_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "ORG_CODE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "ORG_NAME" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_GDAICO_CALL"."ID" IS '统计主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_GDAICO_CALL"."USER_ACCOUNT" IS '调用账户';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_GDAICO_CALL"."CALL_TIME" IS '调用时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_GDAICO_CALL"."AGENT_ID" IS '智能体ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_GDAICO_CALL"."TITLE" IS '智能体名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_GDAICO_CALL"."BRIEF" IS '智能体描述';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_GDAICO_CALL"."USER_NAME" IS '智能体创建名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_GDAICO_CALL"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_GDAICO_CALL"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_GDAICO_CALL"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_GDAICO_CALL"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_GDAICO_CALL"."UPDATE_NAME" IS '更新人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_GDAICO_CALL"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_GDAICO_CALL"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_GDAICO_CALL"."ORG_CODE" IS '组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_GDAICO_CALL"."ORG_NAME" IS '组织名称';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_HINT_SHOW
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_HINT_SHOW";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_HINT_SHOW" (
  "ID" INT8 NOT NULL,
  "HINT_CODE" VARCHAR(256) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" INT8,
  "UPDATE_ID" INT8,
  "CREATE_TIME" TIMESTAMP(0),
  "UPDATE_TIME" TIMESTAMP(0),
  "DELETE_FLAG" INT4 DEFAULT 0,
  "ORG_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_HINT_SHOW"."ID" IS 'ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_HINT_SHOW"."HINT_CODE" IS '提示CODE';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_HINT_SHOW"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_HINT_SHOW"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_HINT_SHOW"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_HINT_SHOW"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_HINT_SHOW"."DELETE_FLAG" IS '是否删除 1：删除';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_HINT_SHOW"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_HINT_SHOW"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_HINT_SHOW"."ORG_CODE" IS '组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_HINT_SHOW"."UPDATE_NAME" IS '更新人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_HINT_SHOW"."CREATE_NAME" IS '创建人名称';
COMMENT ON TABLE "KNOWLEDGE"."GAIXC_AGENT_HINT_SHOW" IS '温馨提示-是否展示';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_PLATFORM_AGENT_ACCESS_RECORD
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_AGENT_ACCESS_RECORD";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_AGENT_ACCESS_RECORD" (
  "ID" INT8 NOT NULL,
  "APP_ID" INT8 NOT NULL,
  "TYPE" INT4 DEFAULT 0,
  "DELETE_FLAG" INT4 DEFAULT 0,
  "CREATE_TIME" TIMESTAMP(6),
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" INT8,
  "ORG_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_AGENT_ACCESS_RECORD"."TYPE" IS '记录页面：1:看板详情';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_PLATFORM_AGENT_TEAM_PERMISSION_INFO
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_AGENT_TEAM_PERMISSION_INFO";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_AGENT_TEAM_PERMISSION_INFO" (
  "ID" INT8 NOT NULL,
  "AGENT_TEAM_ID" INT8 NOT NULL,
  "AUTH_TYPE" INT4 NOT NULL,
  "UPDATE_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "UPDATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "CREATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" INT8,
  "ORG_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_AGENT_TEAM_PERMISSION_INFO"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_AGENT_TEAM_PERMISSION_INFO"."AGENT_TEAM_ID" IS '团队空间ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_AGENT_TEAM_PERMISSION_INFO"."AUTH_TYPE" IS '授权类型：1 拥有者；2 拥有者和管理员 ；3 全部成员';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_AGENT_TEAM_PERMISSION_INFO"."UPDATE_ID" IS '变更人';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_AGENT_TEAM_PERMISSION_INFO"."UPDATE_TIME" IS '变更时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_AGENT_TEAM_PERMISSION_INFO"."UPDATE_NAME" IS '变更人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_AGENT_TEAM_PERMISSION_INFO"."CREATE_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_AGENT_TEAM_PERMISSION_INFO"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_AGENT_TEAM_PERMISSION_INFO"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_AGENT_TEAM_PERMISSION_INFO"."ORG_ID" IS '归属组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_AGENT_TEAM_PERMISSION_INFO"."ORG_CODE" IS '归属组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_AGENT_TEAM_PERMISSION_INFO"."ORG_NAME" IS '归属组织名称';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_PLATFORM_APP_BI_REL
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APP_BI_REL";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APP_BI_REL" (
  "REL_ID" INT8 NOT NULL,
  "APP_ID" INT8 NOT NULL,
  "KNOWLEDGE_ID" INT8 NOT NULL,
  "DELETE_FLAG" INT2,
  "CREATE_TIME" TIMESTAMP(6),
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" INT8,
  "ORG_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APP_BI_REL"."REL_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APP_BI_REL"."APP_ID" IS '智能体ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APP_BI_REL"."KNOWLEDGE_ID" IS 'BI知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APP_BI_REL"."DELETE_FLAG" IS '删除状态：0正常，1删除';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APP_BI_REL"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APP_BI_REL"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APP_BI_REL"."CREATE_NAME" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APP_BI_REL"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APP_BI_REL"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APP_BI_REL"."UPDATE_NAME" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APP_BI_REL"."ORG_ID" IS '归属组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APP_BI_REL"."ORG_CODE" IS '归属组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APP_BI_REL"."ORG_NAME" IS '归属组织名称';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_PLATFORM_APPS_TEMPLATE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE" (
  "ID" INT8 NOT NULL,
  "TEMPLATE_AVATAR" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "TEMPLATE_INTRO" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "TEMPLATE_NAME" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "SMART_LABEL_ID" INT4,
  "TEMPLATE_TYPE" INT4,
  "APPS_SAMPLE" INT4 DEFAULT 0,
  "ANSWER_TYPE" INT4,
  "OUTPUT_TYPE" INT4,
  "ORG_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT4 DEFAULT 0,
  "REL_MODEL_ID" INT8,
  "TEMPLATE_PROMPT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "TEMPLATE_AFFILIATE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "APP_TYPE" INT4,
  "TEMPLATE_MODULES" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "RETRIEVAL_INFO" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "APP_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."ID" IS '主键标识';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."TEMPLATE_AVATAR" IS '应用LOGO';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."TEMPLATE_INTRO" IS '应用简介';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."TEMPLATE_NAME" IS '应用名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."SMART_LABEL_ID" IS '标签ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."TEMPLATE_TYPE" IS '模板类型，0：企业知识问答类 1：应用场景类';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."APPS_SAMPLE" IS '智能体模式 0:正常模型 1:简单模式';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."ANSWER_TYPE" IS '回答方式，0：模型回答 1：直接回答';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."OUTPUT_TYPE" IS '输出方式，0：流式输出 1：非流式输出';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."ORG_CODE" IS '组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."UPDATE_NAME" IS '更新人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."DELETE_FLAG" IS '删除状态(0:正常 1:删除)';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."REL_MODEL_ID" IS '基础大模型ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."TEMPLATE_PROMPT" IS '指令集';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."TEMPLATE_AFFILIATE" IS '基础大模型配置';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."APP_TYPE" IS '智能体类型';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."TEMPLATE_MODULES" IS '应用编排内容';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."RETRIEVAL_INFO" IS '知识库相关配置';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE"."APP_ID" IS '智能体ID';
COMMENT ON TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE" IS '智能体模板表';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE" (
  "ID" INT8 NOT NULL,
  "APPS_ID" INT8,
  "MODULE_ID" INT8,
  "MODULE_TYPE" INT4,
  "PLUGIN_MACHINE_ID" INT8,
  "MODULE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT4 DEFAULT 0,
  "INFO_CONTENT" VARCHAR(1024) COLLATE "PG_CATALOG"."DEFAULT",
  "TEMPLATE_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE"."ID" IS '主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE"."APPS_ID" IS '智能体ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE"."MODULE_ID" IS '组件ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE"."MODULE_TYPE" IS '组件类型，1-插件，2-工作流，3-知识库，4-开场白 5-推荐问题';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE"."PLUGIN_MACHINE_ID" IS '组件类型为插件时，会有工具ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE"."MODULE_NAME" IS '组件名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE"."ORG_CODE" IS '组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE"."UPDATE_NAME" IS '更新人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE"."DELETE_FLAG" IS '删除状态(0:正常 1:删除)';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE"."INFO_CONTENT" IS '内容';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE"."TEMPLATE_ID" IS '模板ID';
COMMENT ON TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE" IS '智能体和组件关联';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM" (
  "BI_CHAT_REL_ID" INT8 NOT NULL,
  "APP_ID" INT8,
  "CHAT_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CHAT_TITLE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "KNOWLEDGE_BASE_ID" INT8,
  "BI_CHAT_SESSION_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "DELETE_FLAG" INT4,
  "CREATE_USER_ID" INT8,
  "CREATE_DATE" TIMESTAMP(6)
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM"."BI_CHAT_REL_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM"."APP_ID" IS '智能体ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM"."CHAT_ID" IS '会话ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM"."CHAT_TITLE" IS '会话名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM"."KNOWLEDGE_BASE_ID" IS 'BI知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM"."BI_CHAT_SESSION_ID" IS 'BI会话ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM"."DELETE_FLAG" IS '是否删除';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM"."CREATE_USER_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM"."CREATE_DATE" IS '创建时间';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM_DETAIL
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM_DETAIL";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM_DETAIL" (
  "ID" INT8 NOT NULL,
  "APP_ID" INT8,
  "CHAT_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "KNOWLEDGE_BASE_ID" INT8,
  "BI_CHAT_SESSION_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "BI_CHAT_ITEM_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "USER_QUERY" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "AI_ANSWER" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CHAT_ITEM_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "DELETE_FLAG" INT4
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM_DETAIL"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM_DETAIL"."APP_ID" IS '智能体ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM_DETAIL"."CHAT_ID" IS '智能体会话ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM_DETAIL"."KNOWLEDGE_BASE_ID" IS 'BI知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM_DETAIL"."BI_CHAT_SESSION_ID" IS 'BI会话ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM_DETAIL"."BI_CHAT_ITEM_ID" IS 'BI会话详情ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM_DETAIL"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM_DETAIL"."USER_QUERY" IS '用户问题';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM_DETAIL"."AI_ANSWER" IS 'AI回答';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM_DETAIL"."CHAT_ITEM_ID" IS '智能体会话记录ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM_DETAIL"."DELETE_FLAG" IS '是否删除,1删除，0未删除';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_PLATFORM_BI_FILE_INFO
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_FILE_INFO";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_FILE_INFO" (
  "DOCUMENT_ID" INT8 NOT NULL,
  "APP_ID" INT8 NOT NULL,
  "KNOWLEDGE_BASE_ID" INT8 NOT NULL,
  "DOCUMENT_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "DOCUMENT_URL" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "DOCUMENT_LENGTH" INT8,
  "DELETE_FLAG" INT2,
  "CREATE_TIME" TIMESTAMP(6),
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" INT8,
  "ORG_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "KNOWLEDGE_TABLE_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "DDL_SQL" TEXT COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_FILE_INFO"."DOCUMENT_ID" IS 'EXCEL文件ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_FILE_INFO"."APP_ID" IS 'APP_ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_FILE_INFO"."KNOWLEDGE_BASE_ID" IS 'CHATBI知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_FILE_INFO"."DOCUMENT_NAME" IS '文件名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_FILE_INFO"."DOCUMENT_URL" IS '文件地址';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_FILE_INFO"."DOCUMENT_LENGTH" IS '文件大小';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_FILE_INFO"."DELETE_FLAG" IS '状态:0正常，1删除';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_FILE_INFO"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_FILE_INFO"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_FILE_INFO"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_FILE_INFO"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_FILE_INFO"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_FILE_INFO"."UPDATE_NAME" IS '更新人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_FILE_INFO"."ORG_ID" IS '归属组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_FILE_INFO"."ORG_CODE" IS '归属组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_FILE_INFO"."ORG_NAME" IS '归属组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_FILE_INFO"."KNOWLEDGE_TABLE_CODE" IS '表编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_FILE_INFO"."DDL_SQL" IS '建表SQL';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD" (
  "ID" INT8 NOT NULL,
  "APP_ID" INT8 NOT NULL,
  "CHAT_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "WORD_CLOUD" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CHAT_ITEM_ID" INT8 NOT NULL,
  "DELETE_FLAG" INT4 DEFAULT 0,
  "CREATE_TIME" TIMESTAMP(6),
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" INT8,
  "ORG_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CHAT_CREATE_TIME" TIMESTAMP(6),
  "DATA_SOURCE" INT4
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD"."APP_ID" IS '智能体ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD"."CHAT_ID" IS '会话ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD"."WORD_CLOUD" IS '词云关键字';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD"."DELETE_FLAG" IS '删除状态：0正常，1删除';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD"."CREATE_NAME" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD"."UPDATE_NAME" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD"."ORG_ID" IS '归属组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD"."ORG_CODE" IS '归属组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD"."ORG_NAME" IS '归属组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD"."CHAT_CREATE_TIME" IS '聊天记录时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD"."DATA_SOURCE" IS '聊天来源：0：PC ,1 : APP ，2：API';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_PLATFORM_DATABASE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE" (
  "ID" INT8 NOT NULL,
  "DATABASE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "DATABASE_INTRO" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "DATABASE_AVATAR" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "DATABASE_STATUS" INT4,
  "CHAT_BI_ID" INT8,
  "AGENT_TEAM_ID" INT8,
  "LABEL_CODE" INT8,
  "DELETE_FLAG" INT4 NOT NULL,
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "ORG_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CODE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE"."ID" IS '数据库主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE"."DATABASE_NAME" IS '数据库名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE"."DATABASE_INTRO" IS '数据库描述';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE"."DATABASE_AVATAR" IS '数据库LOGO';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE"."DATABASE_STATUS" IS '数据库状态1：启用，2：禁用';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE"."CHAT_BI_ID" IS '数据库关联CHATBI';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE"."AGENT_TEAM_ID" IS '团队ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE"."LABEL_CODE" IS '所属业务域';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE"."DELETE_FLAG" IS '删除状态(0:正常 1:删除)';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE"."UPDATE_NAME" IS '更新人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE"."ORG_CODE" IS '组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE"."ORG_NAME" IS '组织名称';
COMMENT ON TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE" IS '数据库主表';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_PLATFORM_DATABASE_FIELD
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD" (
  "ID" INT8 NOT NULL,
  "DATABASE_ID" INT8,
  "FILE_ID" INT8,
  "FIELD_NAME" VARCHAR(120) COLLATE "PG_CATALOG"."DEFAULT",
  "FIELD_CODE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "FIELD_TYPE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "FIELD_DESC" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "FIELD_SORT" INT4,
  "FIELD_LENGTH" INT4,
  "FIELD_FORMAT" VARCHAR(20) COLLATE "PG_CATALOG"."DEFAULT",
  "IS_ACCOUNT_PERIOD" INT4,
  "IS_INDEX" INT4,
  "IS_DIM" INT4,
  "IS_REQUIRED" INT4,
  "DELETE_FLAG" INT4 NOT NULL,
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "ORG_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CODE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "FIELD_SYNONYM" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."ID" IS '数据库文件详情主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."DATABASE_ID" IS '数据库ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."FILE_ID" IS '文件ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."FIELD_NAME" IS '字段名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."FIELD_CODE" IS '字段编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."FIELD_TYPE" IS '字段类型';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."FIELD_DESC" IS '字段描述';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."FIELD_SORT" IS '字段排序';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."FIELD_LENGTH" IS '字段长度';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."FIELD_FORMAT" IS '字段格式（时间）';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."IS_ACCOUNT_PERIOD" IS '是否账期';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."IS_INDEX" IS '是否指标';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."IS_DIM" IS '是否维度';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."IS_REQUIRED" IS '是否必填';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."DELETE_FLAG" IS '删除状态(0:正常 1:删除)';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."UPDATE_NAME" IS '更新人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."ORG_CODE" IS '组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD"."FIELD_SYNONYM" IS '字段同义词';
COMMENT ON TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD" IS '数据库文件详情表';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_PLATFORM_DATABASE_FILE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE" (
  "ID" INT8 NOT NULL,
  "DATABASE_ID" INT8,
  "FOLDER_ID" INT8,
  "FILE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_SIZE" INT8,
  "FILE_URL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TABLE_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "BATCH_CODE" INT8,
  "HANDLE_STATE" INT4,
  "FILE_SUFFIX" INT4,
  "FILE_TYPE" INT2,
  "DELETE_FLAG" INT4 NOT NULL,
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "ORG_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CODE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE"."ID" IS '数据库文件主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE"."DATABASE_ID" IS '数据库ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE"."FOLDER_ID" IS '目录ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE"."FILE_NAME" IS '名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE"."FILE_SIZE" IS '大小';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE"."FILE_URL" IS '存储位置';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE"."TABLE_CODE" IS '表编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE"."BATCH_CODE" IS '上传批次编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE"."HANDLE_STATE" IS '处理状态 1: 上传中,2: 上传失败,3: 上传成功,4: 解析失败,5: 解析中,6: 解析成功,7: 复制中,8: 复制失败,9: 加入数据库';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE"."FILE_SUFFIX" IS '文件后缀 1: XLS,2: XLSX';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE"."FILE_TYPE" IS '文件类型 1: 文件,2: 目录';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE"."DELETE_FLAG" IS '删除状态(0:正常 1:删除)';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE"."UPDATE_NAME" IS '更新人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE"."ORG_CODE" IS '组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE"."ORG_NAME" IS '组织名称';
COMMENT ON TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE" IS '数据库文件表';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_PLATFORM_DATABASE_FILE_DATA
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_DATA";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_DATA" (
  "ID" INT8 NOT NULL,
  "DATABASE_ID" INT8,
  "FILE_ID" INT8,
  "FILE_DATA" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "DELETE_FLAG" INT4 NOT NULL,
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "ORG_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CODE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_DATA"."ID" IS '数据库文件数据主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_DATA"."DATABASE_ID" IS '数据库ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_DATA"."FILE_ID" IS '文件ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_DATA"."FILE_DATA" IS '文件数据';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_DATA"."DELETE_FLAG" IS '删除状态(0:正常 1:删除)';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_DATA"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_DATA"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_DATA"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_DATA"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_DATA"."UPDATE_NAME" IS '更新人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_DATA"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_DATA"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_DATA"."ORG_CODE" IS '组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_DATA"."ORG_NAME" IS '组织名称';
COMMENT ON TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_DATA" IS '数据库文件数据表';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_PLATFORM_DATABASE_FILE_TEMP
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_TEMP";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_TEMP" (
  "ID" INT8 NOT NULL,
  "DATABASE_ID" INT8,
  "FILE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_SIZE" INT8,
  "FILE_URL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "HANDLE_STATE" INT4,
  "FILE_SUFFIX" INT4,
  "DELETE_FLAG" INT4 NOT NULL,
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "ORG_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CODE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "ERROR_MSG" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_TEMP"."ID" IS '数据库文件数据主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_TEMP"."DATABASE_ID" IS '数据库ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_TEMP"."HANDLE_STATE" IS '处理状态 1: 上传中,2: 上传失败,3: 上传成功,4: 解析失败,5: 解析中,6: 解析成功,7: 复制中,8: 复制失败,9: 加入数据库';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_TEMP"."DELETE_FLAG" IS '删除状态(0:正常 1:删除)';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_TEMP"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_TEMP"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_TEMP"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_TEMP"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_TEMP"."UPDATE_NAME" IS '更新人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_TEMP"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_TEMP"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_TEMP"."ORG_CODE" IS '组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_TEMP"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_TEMP"."ERROR_MSG" IS '错误信息';
COMMENT ON TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_TEMP" IS '数据库临时文件表';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_PLATFORM_DATABASE_FOLDER
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FOLDER";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FOLDER" (
  "ID" INT8 NOT NULL,
  "PARENT_ID" INT8,
  "DATABASE_ID" INT8,
  "FOLDER_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "FOLDER_INDEX" INT4,
  "FOLDER_LEVEL" INT4,
  "FULL_PATH_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "FULL_PATH_NAME" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "DELETE_FLAG" INT4 NOT NULL,
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "ORG_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CODE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FOLDER"."ID" IS '数据库目录主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FOLDER"."PARENT_ID" IS '父目录ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FOLDER"."DATABASE_ID" IS '数据库ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FOLDER"."FOLDER_NAME" IS '名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FOLDER"."FOLDER_INDEX" IS '排序';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FOLDER"."FOLDER_LEVEL" IS '层级';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FOLDER"."FULL_PATH_ID" IS '全路径ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FOLDER"."FULL_PATH_NAME" IS '全路径名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FOLDER"."DELETE_FLAG" IS '删除状态(0:正常 1:删除)';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FOLDER"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FOLDER"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FOLDER"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FOLDER"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FOLDER"."UPDATE_NAME" IS '更新人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FOLDER"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FOLDER"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FOLDER"."ORG_CODE" IS '组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FOLDER"."ORG_NAME" IS '组织名称';
COMMENT ON TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FOLDER" IS '数据库目录表';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_PLATFORM_DATASETS_LOG
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_LOG";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_LOG" (
  "ID" INT8 NOT NULL,
  "DATASETS_ID" INT8 NOT NULL,
  "OPERATION_TYPE" INT4,
  "DATA_TYPE" INT4,
  "OPERATION_DETAILS" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CODE" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_NAME" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_ID" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_NAME" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT4
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_LOG"."ID" IS '主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_LOG"."DATASETS_ID" IS '知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_LOG"."OPERATION_TYPE" IS '操作类型:1新增知识库 2修改知识库 3删除知识库 4知识库文件上传 5知识库文件切割 6知识库文件删除';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_LOG"."DATA_TYPE" IS '知识库类型:1平台 2算法';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_LOG"."OPERATION_DETAILS" IS '操作明细';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_LOG"."FILE_NAME" IS '文件名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_LOG"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_LOG"."ORG_CODE" IS '组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_LOG"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_LOG"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_LOG"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_LOG"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_LOG"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_LOG"."UPDATE_NAME" IS '更新人名称';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_LOG"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_LOG"."DELETE_FLAG" IS '删除状态 0正常 1删除';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_PLATFORM_DATASETS_TOPIC
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_TOPIC";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_TOPIC" (
  "DATASET_ID" INT8 NOT NULL,
  "TOPIC_ID" INT4 NOT NULL,
  "DELETE_FLAG" INT4 NOT NULL,
  "ID" INT8 NOT NULL
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_TOPIC"."DATASET_ID" IS '知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_TOPIC"."TOPIC_ID" IS '主题ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_TOPIC"."DELETE_FLAG" IS '是否删除';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_PLATFORM_USER_RERANK_REL
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_USER_RERANK_REL";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_USER_RERANK_REL" (
  "USER_ID" INT8 NOT NULL,
  "USER_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "USER_ACCOUNT" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "RERANK_URL" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "RERANK_TYPE" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "DELETE_FLAG" INT4 NOT NULL
)
;
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_USER_RERANK_REL"."USER_ID" IS '用户ID';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_USER_RERANK_REL"."USER_NAME" IS '用户名';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_USER_RERANK_REL"."USER_ACCOUNT" IS '用户编码';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_USER_RERANK_REL"."RERANK_URL" IS '重排地址';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_USER_RERANK_REL"."RERANK_TYPE" IS '重排类型：DOCCHAIN  FAAS';
COMMENT ON COLUMN "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_USER_RERANK_REL"."DELETE_FLAG" IS '删除标识';

-- ----------------------------
-- TABLE STRUCTURE FOR GAIXC_AGENT_WATTPC_JUMP_INFO
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."GAIXC_AGENT_WATTPC_JUMP_INFO";
CREATE TABLE "KNOWLEDGE"."GAIXC_AGENT_WATTPC_JUMP_INFO" (
  "ID" INT8 NOT NULL,
  "PAGE_TYPE" INT4,
  "FILE_IDS" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "DRIVE_ID" VARCHAR(55) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_USER_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6)
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR HIGH_CODE_TEMPLATE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."HIGH_CODE_TEMPLATE";
CREATE TABLE "KNOWLEDGE"."HIGH_CODE_TEMPLATE" (
  "TEMPLATE_ID" INT8 NOT NULL,
  "TEMPLATE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TEMPLATE_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TEMPLATE_TYPE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "SUB_TYPE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CODE_LANGUAGE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CODE_FRAMEWORK" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CODE_TEMPLATE" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "MARKDOWN" TEXT COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."HIGH_CODE_TEMPLATE"."TEMPLATE_ID" IS '模板ID';
COMMENT ON COLUMN "KNOWLEDGE"."HIGH_CODE_TEMPLATE"."TEMPLATE_NAME" IS '模板名称';
COMMENT ON COLUMN "KNOWLEDGE"."HIGH_CODE_TEMPLATE"."TEMPLATE_CODE" IS '模板编码';
COMMENT ON COLUMN "KNOWLEDGE"."HIGH_CODE_TEMPLATE"."TEMPLATE_TYPE" IS '模板类型';
COMMENT ON COLUMN "KNOWLEDGE"."HIGH_CODE_TEMPLATE"."SUB_TYPE" IS '子类型';
COMMENT ON COLUMN "KNOWLEDGE"."HIGH_CODE_TEMPLATE"."CODE_LANGUAGE" IS '代码语言。JAVASCRIPT和PYTHON';
COMMENT ON COLUMN "KNOWLEDGE"."HIGH_CODE_TEMPLATE"."CODE_FRAMEWORK" IS '代码框架';
COMMENT ON COLUMN "KNOWLEDGE"."HIGH_CODE_TEMPLATE"."CODE_TEMPLATE" IS '代码模板';

-- ----------------------------
-- TABLE STRUCTURE FOR IM_AGENT_DATASET_UPLOAD_FILE_TEMP_INFO
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."IM_AGENT_DATASET_UPLOAD_FILE_TEMP_INFO";
CREATE TABLE "KNOWLEDGE"."IM_AGENT_DATASET_UPLOAD_FILE_TEMP_INFO" (
  "ID" INT8 NOT NULL,
  "BATCH_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_URL" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "DATASET_ID" INT8,
  "OPTIMISTIC_LOCK_VERSION" NUMERIC(12,0) DEFAULT NULL::NUMERIC,
  "PROVINCE_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "UPDATER_ID" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "BUREAU_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "CREATOR_ID" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "DELETE_FLAG" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "TISSUE_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "UPDATE_TIME" TIMESTAMP(6),
  "CREATE_TIME" TIMESTAMP(6)
)
;
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_DATASET_UPLOAD_FILE_TEMP_INFO"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_DATASET_UPLOAD_FILE_TEMP_INFO"."BATCH_ID" IS '批次号';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_DATASET_UPLOAD_FILE_TEMP_INFO"."FILE_NAME" IS '文件名称';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_DATASET_UPLOAD_FILE_TEMP_INFO"."FILE_URL" IS '文件路径';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_DATASET_UPLOAD_FILE_TEMP_INFO"."DATASET_ID" IS '文件所属知识库';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_DATASET_UPLOAD_FILE_TEMP_INFO"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_DATASET_UPLOAD_FILE_TEMP_INFO"."PROVINCE_CODE" IS '省编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_DATASET_UPLOAD_FILE_TEMP_INFO"."UPDATER_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_DATASET_UPLOAD_FILE_TEMP_INFO"."BUREAU_CODE" IS '局编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_DATASET_UPLOAD_FILE_TEMP_INFO"."CREATOR_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_DATASET_UPLOAD_FILE_TEMP_INFO"."DATA_FROM" IS '数据来源';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_DATASET_UPLOAD_FILE_TEMP_INFO"."DELETE_FLAG" IS '删除标识';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_DATASET_UPLOAD_FILE_TEMP_INFO"."TISSUE_CODE" IS '组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_DATASET_UPLOAD_FILE_TEMP_INFO"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_DATASET_UPLOAD_FILE_TEMP_INFO"."CREATE_TIME" IS '创建时间';

-- ----------------------------
-- TABLE STRUCTURE FOR IM_AGENT_PLUGIN_CANCEL_SHARE_LOG
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."IM_AGENT_PLUGIN_CANCEL_SHARE_LOG";
CREATE TABLE "KNOWLEDGE"."IM_AGENT_PLUGIN_CANCEL_SHARE_LOG" (
  "ID" INT8 NOT NULL,
  "PLUGIN_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CANCEL_USER_ID" INT8,
  "CANCEL_REASON" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "CANCEL_TIME" TIMESTAMP(6),
  "CANCEL_PAGE" INT4 DEFAULT 1,
  "VERSION_NUM" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATOR_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATER_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "DELETE_FLAG" INT4 DEFAULT 0
)
;
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_CANCEL_SHARE_LOG"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_CANCEL_SHARE_LOG"."PLUGIN_ID" IS '插件ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_CANCEL_SHARE_LOG"."CANCEL_USER_ID" IS '取消共享人';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_CANCEL_SHARE_LOG"."CANCEL_REASON" IS '取消共享原因';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_CANCEL_SHARE_LOG"."CANCEL_TIME" IS '取消共享时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_CANCEL_SHARE_LOG"."CANCEL_PAGE" IS '取消页面：1：本人/团队 2：运营管理员';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_CANCEL_SHARE_LOG"."CREATOR_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_CANCEL_SHARE_LOG"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_CANCEL_SHARE_LOG"."UPDATER_ID" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_CANCEL_SHARE_LOG"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_CANCEL_SHARE_LOG"."DATA_FROM" IS '数据来源';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_CANCEL_SHARE_LOG"."PROVINCE_CODE" IS '分子公司编码/省编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_CANCEL_SHARE_LOG"."BUREAU_CODE" IS '局编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_CANCEL_SHARE_LOG"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_CANCEL_SHARE_LOG"."DELETE_FLAG" IS '是否删除：1：删除';
COMMENT ON TABLE "KNOWLEDGE"."IM_AGENT_PLUGIN_CANCEL_SHARE_LOG" IS '插件取消分享表';

-- ----------------------------
-- TABLE STRUCTURE FOR IM_AGENT_PLUGIN_SHARE_LOG
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG";
CREATE TABLE "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG" (
  "ID" INT8 NOT NULL,
  "PLUGIN_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_RANGE" INT4 DEFAULT 0,
  "ASSIGN_TYPE" INT4 DEFAULT 0,
  "IS_OFFICIAL" INT4 NOT NULL DEFAULT 0,
  "ORG_PROVINCE" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CITY" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATOR_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATER_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "DELETE_FLAG" INT4 DEFAULT 0,
  "IS_COPY" INT4 DEFAULT 0,
  "ORG_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ASSIGN_CONTENT" TEXT COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG"."PLUGIN_ID" IS '插件ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG"."ORG_RANGE" IS '固定范围：1：全网  2：全省 3：全市';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG"."ASSIGN_TYPE" IS '指定类型：1：个人  2：团队';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG"."IS_OFFICIAL" IS '是否官方共享 0否 1是';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG"."ORG_PROVINCE" IS '省组织';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG"."ORG_CITY" IS '市组织';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG"."CREATOR_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG"."UPDATER_ID" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG"."DATA_FROM" IS '数据来源';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG"."PROVINCE_CODE" IS '分子公司编码/省编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG"."BUREAU_CODE" IS '局编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG"."DELETE_FLAG" IS '是否删除：1：删除';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG"."IS_COPY" IS '是否可复制 0：否 ，1：是';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG"."ORG_CODE" IS '组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG"."ASSIGN_CONTENT" IS '指定内容用,分割';
COMMENT ON TABLE "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG" IS '插件共享记录表';

-- ----------------------------
-- TABLE STRUCTURE FOR IM_AGENT_PLUGIN_UPVOTE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."IM_AGENT_PLUGIN_UPVOTE";
CREATE TABLE "KNOWLEDGE"."IM_AGENT_PLUGIN_UPVOTE" (
  "ID" INT8 NOT NULL,
  "PLUGIN_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATOR_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATER_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "DELETE_FLAG" INT4 DEFAULT 0
)
;
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_UPVOTE"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_UPVOTE"."PLUGIN_ID" IS '插件ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_UPVOTE"."CREATOR_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_UPVOTE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_UPVOTE"."UPDATER_ID" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_UPVOTE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_UPVOTE"."DATA_FROM" IS '数据来源';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_UPVOTE"."PROVINCE_CODE" IS '分子公司编码/省编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_UPVOTE"."BUREAU_CODE" IS '局编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_UPVOTE"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_PLUGIN_UPVOTE"."DELETE_FLAG" IS '是否删除：1：删除';
COMMENT ON TABLE "KNOWLEDGE"."IM_AGENT_PLUGIN_UPVOTE" IS '插件点赞表';

-- ----------------------------
-- TABLE STRUCTURE FOR IM_AGENT_REVIEW_OPERATION_LOG
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."IM_AGENT_REVIEW_OPERATION_LOG";
CREATE TABLE "KNOWLEDGE"."IM_AGENT_REVIEW_OPERATION_LOG" (
  "ID" INT8 NOT NULL,
  "OPERATION_TYPE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "OPERATION_MODULE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "OPERATION_DESC" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "OPERATION_TIME" TIMESTAMP(6),
  "OPERATION_USER_ID" INT8,
  "OPERATION_USER_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_OPERATION_LOG"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_OPERATION_LOG"."OPERATION_TYPE" IS '操作⾏为';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_OPERATION_LOG"."OPERATION_MODULE" IS '操作模块';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_OPERATION_LOG"."OPERATION_DESC" IS '操作描述';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_OPERATION_LOG"."OPERATION_TIME" IS '操作时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_OPERATION_LOG"."OPERATION_USER_ID" IS '操作人';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_OPERATION_LOG"."OPERATION_USER_NAME" IS '操作人名称';
COMMENT ON TABLE "KNOWLEDGE"."IM_AGENT_REVIEW_OPERATION_LOG" IS '编审操作记录表';

-- ----------------------------
-- TABLE STRUCTURE FOR IM_AGENT_REVIEW_PROJECT_FILE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."IM_AGENT_REVIEW_PROJECT_FILE";
CREATE TABLE "KNOWLEDGE"."IM_AGENT_REVIEW_PROJECT_FILE" (
  "ID" INT8 NOT NULL,
  "PROJECT_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_NAME" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_URL" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "ILLEGAL_TYPE" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "EXECUTE_STATUS" INT4,
  "ILLEGAL_COUNT" INT4,
  "CREATOR_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATER_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "DELETE_FLAG" INT4 DEFAULT 0,
  "TENDER_INFO" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "PROJECT_TENDERER" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PROJECT_CATEGORY" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TASK_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_PROJECT_FILE"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_PROJECT_FILE"."PROJECT_ID" IS '项目ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_PROJECT_FILE"."FILE_NAME" IS '文件名';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_PROJECT_FILE"."FILE_URL" IS '文件地址';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_PROJECT_FILE"."ILLEGAL_TYPE" IS '违规类型 , 逗号隔开 1,2,3';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_PROJECT_FILE"."EXECUTE_STATUS" IS 'END(1, "全部已完成"),
    FILE_WAIT(2, "文件已接收，等待处理"),
    FILE_ING(3, "文件处理中"),
    FILE_END(4, "文件处理完成"),
    REVIEWING(5, "编审中"),
    FILE_ERROR(6, "文件处理异常"),
    ERROR(7, "编审异常");';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_PROJECT_FILE"."ILLEGAL_COUNT" IS '违规数量';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_PROJECT_FILE"."CREATOR_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_PROJECT_FILE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_PROJECT_FILE"."UPDATER_ID" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_PROJECT_FILE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_PROJECT_FILE"."DATA_FROM" IS '数据来源';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_PROJECT_FILE"."DELETE_FLAG" IS '是否删除 已删除 1';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_PROJECT_FILE"."TENDER_INFO" IS '标的JSON';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_PROJECT_FILE"."PROJECT_TENDERER" IS '项目招标人';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_PROJECT_FILE"."PROJECT_CATEGORY" IS '项目类别';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_PROJECT_FILE"."TASK_ID" IS '任务ID';
COMMENT ON TABLE "KNOWLEDGE"."IM_AGENT_REVIEW_PROJECT_FILE" IS '智能编审-上传文件编审';

-- ----------------------------
-- TABLE STRUCTURE FOR IM_AGENT_REVIEW_SENSITIVE_WORD
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."IM_AGENT_REVIEW_SENSITIVE_WORD";
CREATE TABLE "KNOWLEDGE"."IM_AGENT_REVIEW_SENSITIVE_WORD" (
  "ID" INT8 NOT NULL,
  "SENSITIVE_WORD" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "REMARK_INFO" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "LABEL_TYPE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATOR_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATER_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "DELETE_FLAG" INT4 DEFAULT 0
)
;
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_SENSITIVE_WORD"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_SENSITIVE_WORD"."SENSITIVE_WORD" IS '敏感词';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_SENSITIVE_WORD"."REMARK_INFO" IS '备注信息';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_SENSITIVE_WORD"."LABEL_TYPE" IS '标签类型';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_SENSITIVE_WORD"."CREATOR_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_SENSITIVE_WORD"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_SENSITIVE_WORD"."UPDATER_ID" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_SENSITIVE_WORD"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_SENSITIVE_WORD"."DATA_FROM" IS '数据来源';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_SENSITIVE_WORD"."DELETE_FLAG" IS '是否删除 已删除 1';
COMMENT ON TABLE "KNOWLEDGE"."IM_AGENT_REVIEW_SENSITIVE_WORD" IS '智能编审-敏感词库';

-- ----------------------------
-- TABLE STRUCTURE FOR IM_AGENT_REVIEW_USERS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."IM_AGENT_REVIEW_USERS";
CREATE TABLE "KNOWLEDGE"."IM_AGENT_REVIEW_USERS" (
  "ID" INT8 NOT NULL,
  "USER_ID" INT8,
  "USER_NAME" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "USER_ACCOUNT" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_FULL_NAME" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "USER_STATUS" INT4,
  "USER_ROLE" INT4,
  "TEAM_ID" INT8,
  "CREATOR_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATER_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "DELETE_FLAG" INT4 DEFAULT 0
)
;
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_USERS"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_USERS"."USER_ID" IS '项目ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_USERS"."USER_NAME" IS '文件名';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_USERS"."USER_ACCOUNT" IS 'USER_ACCOUNT';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_USERS"."ORG_NAME" IS '组织名';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_USERS"."ORG_FULL_NAME" IS '全组织名';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_USERS"."USER_STATUS" IS '用户状态：1：启用 2：未启用';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_USERS"."USER_ROLE" IS '用户状态：1：管理员 2：普通成员';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_USERS"."TEAM_ID" IS '团队ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_USERS"."CREATOR_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_USERS"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_USERS"."UPDATER_ID" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_USERS"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_USERS"."DATA_FROM" IS '数据来源';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_REVIEW_USERS"."DELETE_FLAG" IS '是否删除 已删除 1';
COMMENT ON TABLE "KNOWLEDGE"."IM_AGENT_REVIEW_USERS" IS '智能编审-编审用户管理';

-- ----------------------------
-- TABLE STRUCTURE FOR IM_AGENT_WORKFLOW_DEBUG_LOG
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."IM_AGENT_WORKFLOW_DEBUG_LOG";
CREATE TABLE "KNOWLEDGE"."IM_AGENT_WORKFLOW_DEBUG_LOG" (
  "ID" INT8 NOT NULL,
  "PLUGIN_APP_ID" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_MACHINE_ID" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "IS_ERROR" INT4,
  "ERROR_MSG" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "NODE_LOG" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "START_TIME" INT8,
  "END_TIME" INT8,
  "CREATOR_ID" INT8,
  "CREATOR_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATER_ID" INT8,
  "UPDATER_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "DELETE_FLAG" INT4 DEFAULT 0
)
;
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_WORKFLOW_DEBUG_LOG"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_WORKFLOW_DEBUG_LOG"."PLUGIN_APP_ID" IS '工具ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_WORKFLOW_DEBUG_LOG"."IS_ERROR" IS '是否报错';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_WORKFLOW_DEBUG_LOG"."ERROR_MSG" IS '日志信息';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_WORKFLOW_DEBUG_LOG"."NODE_LOG" IS '运行日志';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_WORKFLOW_DEBUG_LOG"."START_TIME" IS '开始时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_WORKFLOW_DEBUG_LOG"."END_TIME" IS '结束时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_WORKFLOW_DEBUG_LOG"."CREATOR_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_WORKFLOW_DEBUG_LOG"."CREATOR_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_WORKFLOW_DEBUG_LOG"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_WORKFLOW_DEBUG_LOG"."UPDATER_ID" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_WORKFLOW_DEBUG_LOG"."UPDATER_NAME" IS '更新人名称';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_WORKFLOW_DEBUG_LOG"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_WORKFLOW_DEBUG_LOG"."DATA_FROM" IS '数据来源';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_WORKFLOW_DEBUG_LOG"."PROVINCE_CODE" IS '分子公司编码/省编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_WORKFLOW_DEBUG_LOG"."BUREAU_CODE" IS '局编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_WORKFLOW_DEBUG_LOG"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."IM_AGENT_WORKFLOW_DEBUG_LOG"."DELETE_FLAG" IS '是否删除：1：删除';
COMMENT ON TABLE "KNOWLEDGE"."IM_AGENT_WORKFLOW_DEBUG_LOG" IS '工作流运行日志表';

-- ----------------------------
-- TABLE STRUCTURE FOR IM_MCP_SERVER_DETAIL
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."IM_MCP_SERVER_DETAIL";
CREATE TABLE "KNOWLEDGE"."IM_MCP_SERVER_DETAIL" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "MCP_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "PACKAGE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_PATH" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "START_ARGS" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "MCP_VERSION" VARCHAR(16) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_MSG" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "MCP_STATUS" INT4 NOT NULL DEFAULT 0,
  "MCP_TOOLS" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CREATOR_ID" INT8,
  "CREATOR_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 NOT NULL DEFAULT 0,
  "UPDATER_ID" INT8,
  "UPDATER_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(2) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL"."ID" IS '主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL"."MCP_ID" IS 'MCPID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL"."PACKAGE_NAME" IS '部署包名称';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL"."FILE_PATH" IS '包文件路径/SSE服务URL';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL"."START_ARGS" IS '启动参数';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL"."MCP_VERSION" IS '版本号';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL"."UPDATE_MSG" IS '更新说明';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL"."MCP_STATUS" IS '是否启用 0 未启用 1 已启用';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL"."MCP_TOOLS" IS '工具列表JSON';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL"."CREATOR_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL"."CREATOR_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL"."DELETE_FLAG" IS '删除状态(0:正常 1:删除) ';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL"."UPDATER_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL"."UPDATER_NAME" IS '更新人名';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL"."BUREAU_CODE" IS '局编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL"."PROVINCE_CODE" IS '省编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL"."DATA_FROM" IS '数据来源';
COMMENT ON TABLE "KNOWLEDGE"."IM_MCP_SERVER_DETAIL" IS '智能体MCP组件版本详情表';

-- ----------------------------
-- TABLE STRUCTURE FOR IM_MCP_SERVER_DETAIL_RELEASE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE";
CREATE TABLE "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "MCP_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "PACKAGE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_PATH" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "START_ARGS" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "MCP_VERSION" VARCHAR(16) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_MSG" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "MCP_STATUS" INT4 NOT NULL DEFAULT 0,
  "MCP_TOOLS" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CREATOR_ID" INT8,
  "CREATOR_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 NOT NULL DEFAULT 0,
  "UPDATER_ID" INT8,
  "UPDATER_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(2) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE"."ID" IS '主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE"."MCP_ID" IS 'MCPID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE"."PACKAGE_NAME" IS '部署包名称';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE"."FILE_PATH" IS '包文件路径/SSE服务URL';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE"."START_ARGS" IS '启动参数';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE"."MCP_VERSION" IS '版本号';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE"."UPDATE_MSG" IS '更新说明';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE"."MCP_STATUS" IS '是否启用 0 未启用 1 已启用';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE"."MCP_TOOLS" IS '工具列表JSON';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE"."CREATOR_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE"."CREATOR_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE"."DELETE_FLAG" IS '删除状态(0:正常 1:删除)';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE"."UPDATER_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE"."UPDATER_NAME" IS '更新人名';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE"."BUREAU_CODE" IS '局编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE"."PROVINCE_CODE" IS '省编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE"."DATA_FROM" IS '数据来源';
COMMENT ON TABLE "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE" IS '智能体MCP组件版本详情表';

-- ----------------------------
-- TABLE STRUCTURE FOR IM_MCP_SERVER_INFO
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."IM_MCP_SERVER_INFO";
CREATE TABLE "KNOWLEDGE"."IM_MCP_SERVER_INFO" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "MCP_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "MCP_LABEL" INT4 NOT NULL DEFAULT 0,
  "MCP_MSG" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "RUNNING_TYPE" INT4 NOT NULL,
  "LANGUAGE_TYPE" INT4,
  "MCP_INTRODUCE" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "AGENT_TEAM_ID" INT8,
  "MCP_AVATAR" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATOR_ID" INT8,
  "CREATOR_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 NOT NULL DEFAULT 0,
  "UPDATER_ID" INT8,
  "UPDATER_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(2) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO"."ID" IS '主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO"."MCP_NAME" IS 'MCP名称';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO"."MCP_LABEL" IS '标签';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO"."MCP_MSG" IS '描述';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO"."RUNNING_TYPE" IS '运行方式 0 进程内 1 SSE协议';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO"."LANGUAGE_TYPE" IS '编程语言 0 PYTHON  1 JAVA ';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO"."MCP_INTRODUCE" IS '介绍';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO"."AGENT_TEAM_ID" IS '团队ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO"."MCP_AVATAR" IS '头图';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO"."CREATOR_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO"."CREATOR_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO"."DELETE_FLAG" IS '删除状态(0:正常 1:删除) ';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO"."UPDATER_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO"."UPDATER_NAME" IS '更新人名';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO"."BUREAU_CODE" IS '局编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO"."PROVINCE_CODE" IS '省编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO"."DATA_FROM" IS '数据来源';
COMMENT ON TABLE "KNOWLEDGE"."IM_MCP_SERVER_INFO" IS '智能体MCP组件基本信息表';

-- ----------------------------
-- TABLE STRUCTURE FOR IM_MCP_SERVER_INFO_RELEASE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE";
CREATE TABLE "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "MCP_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "MCP_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "MCP_LABEL" INT4 NOT NULL DEFAULT 0,
  "MCP_MSG" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "RUNNING_TYPE" INT4 NOT NULL,
  "LANGUAGE_TYPE" INT4,
  "MCP_INTRODUCE" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "AGENT_TEAM_ID" INT8,
  "MCP_AVATAR" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATOR_ID" INT8,
  "CREATOR_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 NOT NULL DEFAULT 0,
  "UPDATER_ID" INT8,
  "UPDATER_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(2) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE"."ID" IS '主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE"."MCP_ID" IS '原信息表MCPID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE"."MCP_NAME" IS 'MCP名称';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE"."MCP_LABEL" IS '标签';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE"."MCP_MSG" IS '描述';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE"."RUNNING_TYPE" IS '运行方式 0 进程内 1 SSE协议';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE"."LANGUAGE_TYPE" IS '编程语言 0 PYTHON  1 JAVA ';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE"."MCP_INTRODUCE" IS '介绍';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE"."AGENT_TEAM_ID" IS '团队ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE"."MCP_AVATAR" IS '头图';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE"."CREATOR_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE"."CREATOR_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE"."DELETE_FLAG" IS '删除状态(0:正常 1:删除) ';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE"."UPDATER_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE"."UPDATER_NAME" IS '更新人名';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE"."BUREAU_CODE" IS '局编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE"."PROVINCE_CODE" IS '省编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE"."DATA_FROM" IS '数据来源';
COMMENT ON TABLE "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE" IS '智能体MCP组件基本信息表';

-- ----------------------------
-- TABLE STRUCTURE FOR IM_MODEL_CONCURRENCY
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."IM_MODEL_CONCURRENCY";
CREATE TABLE "KNOWLEDGE"."IM_MODEL_CONCURRENCY" (
  "MODEL_NAME" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "TOTAL_CONCURRENCY" INT4 DEFAULT 0,
  "SNAPSHOT_TIME" TIMESTAMP(6),
  "CREATOR_ID" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATER_ID" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "DATA_FROM" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT4,
  "DELETE_FLAG" INT4,
  "ID" INT8 NOT NULL,
  "BATCH_DATE" VARCHAR(20) COLLATE "PG_CATALOG"."DEFAULT"
)
WITH (OIDS=TRUE)
;
COMMENT ON COLUMN "KNOWLEDGE"."IM_MODEL_CONCURRENCY"."MODEL_NAME" IS '模型名称';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MODEL_CONCURRENCY"."TOTAL_CONCURRENCY" IS '总并发数';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MODEL_CONCURRENCY"."SNAPSHOT_TIME" IS '快照时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MODEL_CONCURRENCY"."CREATOR_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MODEL_CONCURRENCY"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MODEL_CONCURRENCY"."UPDATER_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MODEL_CONCURRENCY"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MODEL_CONCURRENCY"."DATA_FROM" IS '数据来源';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MODEL_CONCURRENCY"."PROVINCE_CODE" IS '分子公司编码/省编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MODEL_CONCURRENCY"."BUREAU_CODE" IS '局编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MODEL_CONCURRENCY"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MODEL_CONCURRENCY"."DELETE_FLAG" IS '删除标识：1正常；2已删除';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MODEL_CONCURRENCY"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."IM_MODEL_CONCURRENCY"."BATCH_DATE" IS '时间批次';

-- ----------------------------
-- TABLE STRUCTURE FOR IM_USER_CONCURRENCY
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."IM_USER_CONCURRENCY";
CREATE TABLE "KNOWLEDGE"."IM_USER_CONCURRENCY" (
  "USER_NAME" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "USER_ID" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "TOTAL_CONCURRENCY" INT4 DEFAULT 0,
  "SNAPSHOT_TIME" TIMESTAMP(6),
  "CREATOR_ID" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATER_ID" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "DATA_FROM" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT4,
  "DELETE_FLAG" INT4,
  "ID" INT8 NOT NULL,
  "MODEL_NAME" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "USER_TYPE" INT4,
  "BATCH_DATE" VARCHAR(20) COLLATE "PG_CATALOG"."DEFAULT"
)
WITH (OIDS=TRUE)
;
COMMENT ON COLUMN "KNOWLEDGE"."IM_USER_CONCURRENCY"."TOTAL_CONCURRENCY" IS '总并发数';
COMMENT ON COLUMN "KNOWLEDGE"."IM_USER_CONCURRENCY"."SNAPSHOT_TIME" IS '快照时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_USER_CONCURRENCY"."CREATOR_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."IM_USER_CONCURRENCY"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_USER_CONCURRENCY"."UPDATER_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."IM_USER_CONCURRENCY"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."IM_USER_CONCURRENCY"."DATA_FROM" IS '数据来源';
COMMENT ON COLUMN "KNOWLEDGE"."IM_USER_CONCURRENCY"."PROVINCE_CODE" IS '分子公司编码/省编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_USER_CONCURRENCY"."BUREAU_CODE" IS '局编码';
COMMENT ON COLUMN "KNOWLEDGE"."IM_USER_CONCURRENCY"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."IM_USER_CONCURRENCY"."DELETE_FLAG" IS '删除标识：1正常；2已删除';
COMMENT ON COLUMN "KNOWLEDGE"."IM_USER_CONCURRENCY"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."IM_USER_CONCURRENCY"."MODEL_NAME" IS '模型名称';
COMMENT ON COLUMN "KNOWLEDGE"."IM_USER_CONCURRENCY"."USER_TYPE" IS '用户类型(1：普通用户;2:VIP用户)';
COMMENT ON COLUMN "KNOWLEDGE"."IM_USER_CONCURRENCY"."BATCH_DATE" IS '时间批次';

-- ----------------------------
-- TABLE STRUCTURE FOR IMAGES
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."IMAGES";
CREATE TABLE "KNOWLEDGE"."IMAGES" (
  "ID" INT8 NOT NULL,
  "V" INT4,
  "BINARY" BYTEA,
  "CREATE_TIME" TIMESTAMP(6),
  "METADATA" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "TEAMID" INT8,
  "FILE_ID" INT8
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR IMPORT_DOC_ERROR
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."IMPORT_DOC_ERROR";
CREATE TABLE "KNOWLEDGE"."IMPORT_DOC_ERROR" (
  "TITLE" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_DIR" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ERROR" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CRETAE_TIME" TIMESTAMP(6)
)
;
COMMENT ON COLUMN "KNOWLEDGE"."IMPORT_DOC_ERROR"."TITLE" IS '标题';
COMMENT ON COLUMN "KNOWLEDGE"."IMPORT_DOC_ERROR"."FILE_DIR" IS '文件路径';
COMMENT ON COLUMN "KNOWLEDGE"."IMPORT_DOC_ERROR"."ERROR" IS '错误原因';
COMMENT ON COLUMN "KNOWLEDGE"."IMPORT_DOC_ERROR"."CRETAE_TIME" IS '生成时间
';

-- ----------------------------
-- TABLE STRUCTURE FOR INTELLIGENT_BULLETIN
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."INTELLIGENT_BULLETIN";
CREATE TABLE "KNOWLEDGE"."INTELLIGENT_BULLETIN" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "TITLE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "SUBHEAD" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "HOST_ORG" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "SUB_ORG" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "GENERATION_DATE" DATE,
  "SEARCH_START_DATE" DATE,
  "SEARCH_END_DATE" DATE,
  "THEME" VARCHAR(5000) COLLATE "PG_CATALOG"."DEFAULT",
  "SEARCH_COUNT" INT4,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "USER_ID" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "USER_NAME" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "SEARCH_TIME" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."INTELLIGENT_BULLETIN"."ID" IS '唯一标识';
COMMENT ON COLUMN "KNOWLEDGE"."INTELLIGENT_BULLETIN"."TITLE" IS '标题';
COMMENT ON COLUMN "KNOWLEDGE"."INTELLIGENT_BULLETIN"."SUBHEAD" IS '副标题';
COMMENT ON COLUMN "KNOWLEDGE"."INTELLIGENT_BULLETIN"."HOST_ORG" IS '主办机构';
COMMENT ON COLUMN "KNOWLEDGE"."INTELLIGENT_BULLETIN"."SUB_ORG" IS '协办机构';
COMMENT ON COLUMN "KNOWLEDGE"."INTELLIGENT_BULLETIN"."GENERATION_DATE" IS '生成日期';
COMMENT ON COLUMN "KNOWLEDGE"."INTELLIGENT_BULLETIN"."SEARCH_START_DATE" IS '搜索开始日期';
COMMENT ON COLUMN "KNOWLEDGE"."INTELLIGENT_BULLETIN"."SEARCH_END_DATE" IS '搜索结束日期';
COMMENT ON COLUMN "KNOWLEDGE"."INTELLIGENT_BULLETIN"."THEME" IS '主题';
COMMENT ON COLUMN "KNOWLEDGE"."INTELLIGENT_BULLETIN"."SEARCH_COUNT" IS '搜索结构总条数';
COMMENT ON COLUMN "KNOWLEDGE"."INTELLIGENT_BULLETIN"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."INTELLIGENT_BULLETIN"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."INTELLIGENT_BULLETIN"."USER_ID" IS '用户ID
';
COMMENT ON COLUMN "KNOWLEDGE"."INTELLIGENT_BULLETIN"."USER_NAME" IS '用户名称';
COMMENT ON COLUMN "KNOWLEDGE"."INTELLIGENT_BULLETIN"."SEARCH_TIME" IS '搜索耗时';
COMMENT ON TABLE "KNOWLEDGE"."INTELLIGENT_BULLETIN" IS '简报记录';

-- ----------------------------
-- TABLE STRUCTURE FOR KNOW_CREAT_FLOW
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."KNOW_CREAT_FLOW";
CREATE TABLE "KNOWLEDGE"."KNOW_CREAT_FLOW" (
  "CREAT_FLOW_ID" INT8 NOT NULL,
  "FLOW_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "FLOW_MODULE" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_BY" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "STATUS" VARCHAR(2) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."KNOW_CREAT_FLOW"."CREAT_FLOW_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."KNOW_CREAT_FLOW"."FLOW_NAME" IS '名称';
COMMENT ON COLUMN "KNOWLEDGE"."KNOW_CREAT_FLOW"."FLOW_MODULE" IS '模块编排';
COMMENT ON COLUMN "KNOWLEDGE"."KNOW_CREAT_FLOW"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."KNOW_CREAT_FLOW"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."KNOW_CREAT_FLOW"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."KNOW_CREAT_FLOW"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."KNOW_CREAT_FLOW"."STATUS" IS '是否启用：1 启用，0不启用';
COMMENT ON TABLE "KNOWLEDGE"."KNOW_CREAT_FLOW" IS '构建策略清单表';

-- ----------------------------
-- TABLE STRUCTURE FOR KNOW_CREAT_FLOW_LOG
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."KNOW_CREAT_FLOW_LOG";
CREATE TABLE "KNOWLEDGE"."KNOW_CREAT_FLOW_LOG" (
  "CREAT_FLOW_ID" INT8 NOT NULL,
  "REL_DATASET_FILES_ID" INT8,
  "REL_KNOW_CREAT_FLOW_ID" INT8,
  "REL_KNOW_CREAT_FLOW_SUB_CODE" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "START_TIME" TIMESTAMP(6),
  "END_TIME" TIMESTAMP(6),
  "IN_PARAMS" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "OUT_PARAMS" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "STATUS" VARCHAR(16) COLLATE "PG_CATALOG"."DEFAULT",
  "ANS_STATUS" VARCHAR(16) COLLATE "PG_CATALOG"."DEFAULT",
  "OUT_PARAMS_STAND" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" INT8,
  "CURRENT_FLOW_MODULE" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "FAIL_MSG" TEXT COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."KNOW_CREAT_FLOW_LOG"."CREAT_FLOW_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."KNOW_CREAT_FLOW_LOG"."REL_DATASET_FILES_ID" IS '所属文件标识';
COMMENT ON COLUMN "KNOWLEDGE"."KNOW_CREAT_FLOW_LOG"."REL_KNOW_CREAT_FLOW_ID" IS '所属构建策略标识';
COMMENT ON COLUMN "KNOWLEDGE"."KNOW_CREAT_FLOW_LOG"."REL_KNOW_CREAT_FLOW_SUB_CODE" IS '所属构建策略组件编码';
COMMENT ON COLUMN "KNOWLEDGE"."KNOW_CREAT_FLOW_LOG"."START_TIME" IS '开始时间';
COMMENT ON COLUMN "KNOWLEDGE"."KNOW_CREAT_FLOW_LOG"."END_TIME" IS '结束时间';
COMMENT ON COLUMN "KNOWLEDGE"."KNOW_CREAT_FLOW_LOG"."IN_PARAMS" IS '入参';
COMMENT ON COLUMN "KNOWLEDGE"."KNOW_CREAT_FLOW_LOG"."OUT_PARAMS" IS '出参';
COMMENT ON COLUMN "KNOWLEDGE"."KNOW_CREAT_FLOW_LOG"."STATUS" IS '状态';
COMMENT ON COLUMN "KNOWLEDGE"."KNOW_CREAT_FLOW_LOG"."ANS_STATUS" IS '点赞状态';
COMMENT ON COLUMN "KNOWLEDGE"."KNOW_CREAT_FLOW_LOG"."OUT_PARAMS_STAND" IS '出参纠正';
COMMENT ON COLUMN "KNOWLEDGE"."KNOW_CREAT_FLOW_LOG"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."KNOW_CREAT_FLOW_LOG"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."KNOW_CREAT_FLOW_LOG"."CURRENT_FLOW_MODULE" IS '当前流程模块';
COMMENT ON COLUMN "KNOWLEDGE"."KNOW_CREAT_FLOW_LOG"."FAIL_MSG" IS '失败原因';
COMMENT ON TABLE "KNOWLEDGE"."KNOW_CREAT_FLOW_LOG" IS '构建策略日志表';

-- ----------------------------
-- TABLE STRUCTURE FOR LANGFLOW_MODULE_INFO
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."LANGFLOW_MODULE_INFO";
CREATE TABLE "KNOWLEDGE"."LANGFLOW_MODULE_INFO" (
  "MODULE_ID" INT8 NOT NULL,
  "LANGFLOW_MODULE_NAME" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "LANGFLOW_MODULE_CODE" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "TEMPLATE_ID" INT8,
  "DIR_ID" INT8
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR LM_AGENT_FLOW_RELEASE_VERSION
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."LM_AGENT_FLOW_RELEASE_VERSION";
CREATE TABLE "KNOWLEDGE"."LM_AGENT_FLOW_RELEASE_VERSION" (
  "ID" INT8 NOT NULL,
  "FLOW_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "VERSION_NUM" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "VERSION_DESC" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CREATOR_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATER_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "PROVINCE_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "BUREAU_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "DELETE_FLAG" INT4 DEFAULT 0,
  "JSON_INFO" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "SCRIPT_INFO" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "VERSION_STATUS" INT4 DEFAULT 1,
  "VERSION_SORT" INT4
)
;
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_FLOW_RELEASE_VERSION"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_FLOW_RELEASE_VERSION"."FLOW_ID" IS '工作流ID';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_FLOW_RELEASE_VERSION"."VERSION_NUM" IS '版本号';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_FLOW_RELEASE_VERSION"."VERSION_DESC" IS '版本描述';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_FLOW_RELEASE_VERSION"."CREATOR_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_FLOW_RELEASE_VERSION"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_FLOW_RELEASE_VERSION"."UPDATER_ID" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_FLOW_RELEASE_VERSION"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_FLOW_RELEASE_VERSION"."DATA_FROM" IS '数据来源';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_FLOW_RELEASE_VERSION"."PROVINCE_CODE" IS '分子公司编码/省编码';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_FLOW_RELEASE_VERSION"."BUREAU_CODE" IS '局编码';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_FLOW_RELEASE_VERSION"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_FLOW_RELEASE_VERSION"."DELETE_FLAG" IS '是否删除：1：删除';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_FLOW_RELEASE_VERSION"."JSON_INFO" IS 'JSON字符串：存工作流所有信息';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_FLOW_RELEASE_VERSION"."SCRIPT_INFO" IS 'JSON字符串：存工作流节点信息';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_FLOW_RELEASE_VERSION"."VERSION_STATUS" IS '版本状态，1：启用，2：暂停';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_FLOW_RELEASE_VERSION"."VERSION_SORT" IS '版本序列号';

-- ----------------------------
-- TABLE STRUCTURE FOR LM_AGENT_FUNC_LABEL
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."LM_AGENT_FUNC_LABEL";
CREATE TABLE "KNOWLEDGE"."LM_AGENT_FUNC_LABEL" (
  "ID" INT8 NOT NULL,
  "LABEL_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "LABEL_TYPE" INT4,
  "CREATOR_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATER_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "DELETE_FLAG" INT4 DEFAULT 0,
  "LABEL_SORT" INT4 DEFAULT 0,
  "FUN_CODE" INT4,
  "LABEL_DESC" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_FUNC_LABEL"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_FUNC_LABEL"."LABEL_NAME" IS '标签名';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_FUNC_LABEL"."LABEL_TYPE" IS '标签类型：1-智能体
2-插件
3-知识库
4-工作流
8-MCP
9-数据库'';';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_FUNC_LABEL"."LABEL_SORT" IS '标签排序';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_FUNC_LABEL"."FUN_CODE" IS '功能CODE';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_FUNC_LABEL"."LABEL_DESC" IS '标签描述';
COMMENT ON TABLE "KNOWLEDGE"."LM_AGENT_FUNC_LABEL" IS '功能标签表';

-- ----------------------------
-- TABLE STRUCTURE FOR LM_AGENT_PLUGIN_ADD
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."LM_AGENT_PLUGIN_ADD";
CREATE TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_ADD" (
  "ID" INT8 NOT NULL,
  "PLUGIN_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ADD_TYPE" INT4 DEFAULT 0,
  "USER_ID" INT8,
  "AGENT_TEAM_ID" INT8,
  "CREATOR_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATER_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "DELETE_FLAG" INT4 DEFAULT 0,
  "PLUGIN_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_DESC" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "SMART_LABEL_ID" INT4,
  "FUN_CODE" INT4,
  "PLUGIN_AVATAR" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_ADD"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_ADD"."PLUGIN_ID" IS '插件ID';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_ADD"."ADD_TYPE" IS '类型：1:添加到个人 2:添加到团队';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_ADD"."USER_ID" IS '用户ID';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_ADD"."AGENT_TEAM_ID" IS '团队ID';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_ADD"."CREATOR_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_ADD"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_ADD"."UPDATER_ID" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_ADD"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_ADD"."DATA_FROM" IS '数据来源';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_ADD"."PROVINCE_CODE" IS '分子公司编码/省编码';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_ADD"."BUREAU_CODE" IS '局编码';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_ADD"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_ADD"."DELETE_FLAG" IS '是否删除：1：删除';
COMMENT ON TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_ADD" IS '插件添加表';

-- ----------------------------
-- TABLE STRUCTURE FOR LM_AGENT_PLUGIN_FAVORITE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."LM_AGENT_PLUGIN_FAVORITE";
CREATE TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_FAVORITE" (
  "ID" INT8 NOT NULL,
  "PLUGIN_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATOR_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATER_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "DELETE_FLAG" INT4 DEFAULT 0
)
;
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_FAVORITE"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_FAVORITE"."PLUGIN_ID" IS '插件ID';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_FAVORITE"."CREATOR_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_FAVORITE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_FAVORITE"."UPDATER_ID" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_FAVORITE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_FAVORITE"."DATA_FROM" IS '数据来源';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_FAVORITE"."PROVINCE_CODE" IS '分子公司编码/省编码';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_FAVORITE"."BUREAU_CODE" IS '局编码';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_FAVORITE"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_FAVORITE"."DELETE_FLAG" IS '是否删除：1：删除';
COMMENT ON TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_FAVORITE" IS '插件收藏表';

-- ----------------------------
-- TABLE STRUCTURE FOR LM_AGENT_PLUGIN_MACHINE_EXAMPLE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_EXAMPLE";
CREATE TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_EXAMPLE" (
  "ID" INT8 NOT NULL,
  "PLUGIN_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "MACHINE_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "PARAM_INFO" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CREATOR_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATER_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "DELETE_FLAG" INT4 DEFAULT 0,
  "RESPONSE_INFO" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "IS_RELEASE" INT4
)
;
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_EXAMPLE"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_EXAMPLE"."PLUGIN_ID" IS '插件ID';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_EXAMPLE"."PARAM_INFO" IS '插件参数信息';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_EXAMPLE"."CREATOR_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_EXAMPLE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_EXAMPLE"."UPDATER_ID" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_EXAMPLE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_EXAMPLE"."DATA_FROM" IS '数据来源';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_EXAMPLE"."PROVINCE_CODE" IS '分子公司编码/省编码';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_EXAMPLE"."BUREAU_CODE" IS '局编码';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_EXAMPLE"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_EXAMPLE"."DELETE_FLAG" IS '是否删除：1：删除';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_EXAMPLE"."RESPONSE_INFO" IS '插件返回信息';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_EXAMPLE"."IS_RELEASE" IS '0:保存未发布，1：保存已发的';
COMMENT ON TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_EXAMPLE" IS '插件工具调用示例表';

-- ----------------------------
-- TABLE STRUCTURE FOR LM_AGENT_PLUGIN_MACHINE_STATISTICS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS";
CREATE TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS" (
  "ID" INT8 NOT NULL,
  "PLUGIN_MACHINE_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "PLUGIN_APP_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "REFERENCE_COUNT" INT8 DEFAULT 0,
  "EXECUTION_COUNT" INT8 DEFAULT 0,
  "TOTAL_EXECUTION_TIME" INT8 DEFAULT 0,
  "SUCCESS_COUNT" INT8 DEFAULT 0,
  "CREATOR_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATER_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "DELETE_FLAG" INT4 DEFAULT 0,
  "VERSION_NUM" VARCHAR(20) COLLATE "PG_CATALOG"."DEFAULT",
  "CALL_SOURCE" INT4,
  "CALL_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "OUTPUT_PARAMS" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "INPUT_PARAMS" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "MACHINE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CALL_ORG_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS"."PLUGIN_MACHINE_ID" IS '工具ID';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS"."PLUGIN_APP_ID" IS '插件ID';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS"."REFERENCE_COUNT" IS '引用量';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS"."EXECUTION_COUNT" IS '执行次数';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS"."TOTAL_EXECUTION_TIME" IS '总执行耗时(毫秒)';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS"."SUCCESS_COUNT" IS '成功次数';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS"."CREATOR_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS"."UPDATER_ID" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS"."DATA_FROM" IS '数据来源';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS"."PROVINCE_CODE" IS '分子公司编码/省编码';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS"."BUREAU_CODE" IS '局编码';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS"."DELETE_FLAG" IS '是否删除：1：删除';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS"."VERSION_NUM" IS '版本号';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS"."CALL_SOURCE" IS '调用来源：1：智能体 2:工作流 3：广场调用  4：运营管理员调用';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS"."CALL_ID" IS '调用ID：智能体/工作流';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS"."OUTPUT_PARAMS" IS '出参';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS"."INPUT_PARAMS" IS '入参';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS"."MACHINE_NAME" IS '工具名';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS"."CALL_ORG_NAME" IS '调用单位名';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS"."PLUGIN_NAME" IS '插件名';
COMMENT ON TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS" IS '工具统计表';

-- ----------------------------
-- TABLE STRUCTURE FOR LM_AGENT_PLUGIN_RELEASE_VERSION
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."LM_AGENT_PLUGIN_RELEASE_VERSION";
CREATE TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_RELEASE_VERSION" (
  "ID" INT8 NOT NULL,
  "PLUGIN_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "VERSION_NUM" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "VERSION_DESC" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CREATOR_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATER_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "DELETE_FLAG" INT4 DEFAULT 0,
  "JSON_INFO" TEXT COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_RELEASE_VERSION"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_RELEASE_VERSION"."PLUGIN_ID" IS '插件ID';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_RELEASE_VERSION"."VERSION_NUM" IS '版本号';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_RELEASE_VERSION"."VERSION_DESC" IS '版本描述';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_RELEASE_VERSION"."CREATOR_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_RELEASE_VERSION"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_RELEASE_VERSION"."UPDATER_ID" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_RELEASE_VERSION"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_RELEASE_VERSION"."DATA_FROM" IS '数据来源';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_RELEASE_VERSION"."PROVINCE_CODE" IS '分子公司编码/省编码';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_RELEASE_VERSION"."BUREAU_CODE" IS '局编码';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_RELEASE_VERSION"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_RELEASE_VERSION"."DELETE_FLAG" IS '是否删除：1：删除';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_RELEASE_VERSION"."JSON_INFO" IS 'JSON字符串：存插件所有信息';
COMMENT ON TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_RELEASE_VERSION" IS '插件发布版本历史记录';

-- ----------------------------
-- TABLE STRUCTURE FOR LM_AGENT_PLUGIN_SHARE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE";
CREATE TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE" (
  "ID" INT8 NOT NULL,
  "PLUGIN_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_RANGE" INT4 DEFAULT 0,
  "ASSIGN_TYPE" INT4 DEFAULT 0,
  "IS_OFFICIAL" INT4 NOT NULL DEFAULT 0,
  "ORG_PROVINCE" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CITY" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATOR_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATER_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "DELETE_FLAG" INT4 DEFAULT 0,
  "IS_COPY" INT4 DEFAULT 0,
  "ORG_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE"."PLUGIN_ID" IS '插件ID';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE"."ORG_RANGE" IS '固定范围：1：全网  2：全省 3：全市';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE"."ASSIGN_TYPE" IS '指定类型：1：个人  2：团队';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE"."IS_OFFICIAL" IS '是否官方共享 0否 1是';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE"."ORG_PROVINCE" IS '省组织';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE"."ORG_CITY" IS '市组织';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE"."CREATOR_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE"."UPDATER_ID" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE"."DATA_FROM" IS '数据来源';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE"."PROVINCE_CODE" IS '分子公司编码/省编码';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE"."BUREAU_CODE" IS '局编码';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE"."DELETE_FLAG" IS '是否删除：1：删除';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE"."IS_COPY" IS '是否可复制 0：否 ，1：是';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE"."ORG_CODE" IS '组织编码';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE"."ORG_ID" IS '组织ID';
COMMENT ON TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE" IS '插件共享信息表';

-- ----------------------------
-- TABLE STRUCTURE FOR LM_AGENT_PLUGIN_SHARE_ITEM
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE_ITEM";
CREATE TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE_ITEM" (
  "ID" INT8 NOT NULL,
  "PLUGIN_SHARE_ID" INT8,
  "PLUGIN_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ASSIGN_TYPE" INT4 DEFAULT 0,
  "AGENT_TEAM_ID" INT8,
  "USER_ACCOUNT" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATOR_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATER_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "DELETE_FLAG" INT4 DEFAULT 0
)
;
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE_ITEM"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE_ITEM"."PLUGIN_SHARE_ID" IS '插件共享ID';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE_ITEM"."PLUGIN_ID" IS '插件ID';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE_ITEM"."ASSIGN_TYPE" IS '指定类型：1：个人  2：团队';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE_ITEM"."AGENT_TEAM_ID" IS '团队ID';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE_ITEM"."USER_ACCOUNT" IS '用户账号';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE_ITEM"."CREATOR_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE_ITEM"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE_ITEM"."UPDATER_ID" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE_ITEM"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE_ITEM"."DATA_FROM" IS '数据来源';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE_ITEM"."PROVINCE_CODE" IS '分子公司编码/省编码';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE_ITEM"."BUREAU_CODE" IS '局编码';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE_ITEM"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE_ITEM"."DELETE_FLAG" IS '是否删除：1：删除';
COMMENT ON TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE_ITEM" IS '插件共享指定权限表';

-- ----------------------------
-- TABLE STRUCTURE FOR LM_AGENT_PLUGIN_STATISTICS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."LM_AGENT_PLUGIN_STATISTICS";
CREATE TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_STATISTICS" (
  "ID" INT8 NOT NULL,
  "PLUGIN_APP_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "REFERENCE_COUNT" INT8 DEFAULT 0,
  "EXECUTION_COUNT" INT8 DEFAULT 0,
  "AVG_EXECUTION_TIME" NUMERIC(10,3) DEFAULT 0,
  "SUCCESS_RATE" NUMERIC(5,2) DEFAULT 0,
  "CREATOR_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATER_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "DELETE_FLAG" INT4 DEFAULT 0,
  "FAVORITE_COUNT" INT8,
  "MACHINE_COUNT" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_STATISTICS"."PLUGIN_APP_ID" IS '插件ID';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_STATISTICS"."REFERENCE_COUNT" IS '引用量';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_STATISTICS"."EXECUTION_COUNT" IS '执行次数';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_STATISTICS"."AVG_EXECUTION_TIME" IS '平均执行耗时(秒)';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_STATISTICS"."SUCCESS_RATE" IS '成功率(%)';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_STATISTICS"."CREATOR_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_STATISTICS"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_STATISTICS"."UPDATER_ID" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_STATISTICS"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_STATISTICS"."DATA_FROM" IS '数据来源';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_STATISTICS"."PROVINCE_CODE" IS '分子公司编码/省编码';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_STATISTICS"."BUREAU_CODE" IS '局编码';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_STATISTICS"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_STATISTICS"."DELETE_FLAG" IS '是否删除：1：删除';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_STATISTICS"."FAVORITE_COUNT" IS '收藏量';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_PLUGIN_STATISTICS"."MACHINE_COUNT" IS '工具数量';
COMMENT ON TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_STATISTICS" IS '插件统计表';

-- ----------------------------
-- TABLE STRUCTURE FOR LM_AGENT_REL_WORKFLOW_PLUGIN_INFO
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO";
CREATE TABLE "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO" (
  "ID" INT8 NOT NULL,
  "PLUGIN_MACHINE_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_APP_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATOR_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATER_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "DELETE_FLAG" INT4 DEFAULT 0,
  "WORKFLOW_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO"."PLUGIN_MACHINE_ID" IS '插件工具ID';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO"."PLUGIN_APP_ID" IS '插件ID';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO"."CREATOR_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO"."UPDATER_ID" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO"."DATA_FROM" IS '数据来源';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO"."PROVINCE_CODE" IS '分子公司编码/省编码';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO"."BUREAU_CODE" IS '局编码';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO"."DELETE_FLAG" IS '是否删除：1：删除';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO"."WORKFLOW_ID" IS '工作流ID(PLUGIN_MACHINE表的PLUGIN_MACHINE_ID)';
COMMENT ON TABLE "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO" IS '工作流脚本中的工具解析表';

-- ----------------------------
-- TABLE STRUCTURE FOR LM_AGENT_REL_WORKFLOW_PLUGIN_INFO_RELEASE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO_RELEASE";
CREATE TABLE "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO_RELEASE" (
  "ID" INT8 NOT NULL,
  "PLUGIN_MACHINE_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_APP_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATOR_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATER_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "DATA_FROM" VARCHAR(80) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(8) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "DELETE_FLAG" INT4 DEFAULT 0,
  "WORKFLOW_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO_RELEASE"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO_RELEASE"."PLUGIN_MACHINE_ID" IS '插件工具ID';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO_RELEASE"."PLUGIN_APP_ID" IS '插件ID';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO_RELEASE"."CREATOR_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO_RELEASE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO_RELEASE"."UPDATER_ID" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO_RELEASE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO_RELEASE"."DATA_FROM" IS '数据来源';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO_RELEASE"."PROVINCE_CODE" IS '分子公司编码/省编码';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO_RELEASE"."BUREAU_CODE" IS '局编码';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO_RELEASE"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO_RELEASE"."DELETE_FLAG" IS '是否删除：1：删除';
COMMENT ON COLUMN "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO_RELEASE"."WORKFLOW_ID" IS '工作流ID(PLUGIN_MACHINE_RELEASE表的PLUGIN_MACHINE_ID)';
COMMENT ON TABLE "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO_RELEASE" IS '已发布的工作流脚本中的工具解析表';

-- ----------------------------
-- TABLE STRUCTURE FOR MAX_ID
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."MAX_ID";
CREATE TABLE "KNOWLEDGE"."MAX_ID" (
  "MAX" TEXT COLLATE "PG_CATALOG"."DEFAULT"
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR MERGE_USER_LOG
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."MERGE_USER_LOG";
CREATE TABLE "KNOWLEDGE"."MERGE_USER_LOG" (
  "ID" INT8 NOT NULL,
  "TABLE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "FIELD_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_BEFORE_VALUE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_VALUE" VARCHAR COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_DESC" VARCHAR COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" DATE,
  "CREATE_USER" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ROW_ID" VARCHAR COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."MERGE_USER_LOG"."TABLE_NAME" IS '操作表明';
COMMENT ON COLUMN "KNOWLEDGE"."MERGE_USER_LOG"."FIELD_NAME" IS '字段名';
COMMENT ON COLUMN "KNOWLEDGE"."MERGE_USER_LOG"."UPDATE_BEFORE_VALUE" IS '更新前的值';
COMMENT ON COLUMN "KNOWLEDGE"."MERGE_USER_LOG"."UPDATE_VALUE" IS '更新后的值';
COMMENT ON COLUMN "KNOWLEDGE"."MERGE_USER_LOG"."UPDATE_DESC" IS '更新描述';
COMMENT ON COLUMN "KNOWLEDGE"."MERGE_USER_LOG"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."MERGE_USER_LOG"."CREATE_USER" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."MERGE_USER_LOG"."ROW_ID" IS '记录表主键';
COMMENT ON TABLE "KNOWLEDGE"."MERGE_USER_LOG" IS '合并用户记录日志';

-- ----------------------------
-- TABLE STRUCTURE FOR MODEL_ACCESS_CONTROL
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."MODEL_ACCESS_CONTROL";
CREATE TABLE "KNOWLEDGE"."MODEL_ACCESS_CONTROL" (
  "ID" INT8 NOT NULL,
  "MODEL_BASE_ID" INT8,
  "USER_ACCOUNT" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "APP_ID" INT8,
  "ACCESS_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 NOT NULL DEFAULT 0,
  "EXPIRED_TIME" TIMESTAMP(6),
  "STATUS" INT2,
  "SOURCE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "REMARK" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "SERVER_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_CONTROL"."MODEL_BASE_ID" IS '基础模型ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_CONTROL"."USER_ACCOUNT" IS '用户账号';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_CONTROL"."APP_ID" IS '智能体ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_CONTROL"."ACCESS_TIME" IS '访问时间';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_CONTROL"."DELETE_FLAG" IS '删除状态(0:正常 1:删除) ';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_CONTROL"."EXPIRED_TIME" IS '过期时间';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_CONTROL"."STATUS" IS '状态-0模型获取失败 1模型占用 2模型释放';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_CONTROL"."SOURCE" IS '来源';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_CONTROL"."REMARK" IS '备注';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_CONTROL"."SERVER_NAME" IS '服务ID';
COMMENT ON TABLE "KNOWLEDGE"."MODEL_ACCESS_CONTROL" IS '模型API访问控制';

-- ----------------------------
-- TABLE STRUCTURE FOR MODEL_ACCESS_MANAGE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."MODEL_ACCESS_MANAGE";
CREATE TABLE "KNOWLEDGE"."MODEL_ACCESS_MANAGE" (
  "ID" INT8 NOT NULL,
  "TYPE" INT4,
  "USER_ACCOUNT" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "APP_ID" INT8,
  "STRATEGY_ID" INT8,
  "STATUS" INT4 NOT NULL,
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 NOT NULL DEFAULT 0,
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(2) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "ACCOUNT_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "APP_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ACCOUNT_ORG" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ACCOUNT_ORG_FULL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "IS_USER_DEFINE" INT4,
  "AVATAR" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_MANAGE"."TYPE" IS '1-用户 2智能体';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_MANAGE"."USER_ACCOUNT" IS '用户账号';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_MANAGE"."APP_ID" IS '智能体ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_MANAGE"."STRATEGY_ID" IS '策略ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_MANAGE"."STATUS" IS '状态 0 禁用 1启动';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_MANAGE"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_MANAGE"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_MANAGE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_MANAGE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_MANAGE"."DELETE_FLAG" IS '删除状态(0:正常 1:删除) ';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_MANAGE"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_MANAGE"."UPDATE_NAME" IS '更新人名';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_MANAGE"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_MANAGE"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_MANAGE"."BUREAU_CODE" IS '省编码';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_MANAGE"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_MANAGE"."ACCOUNT_NAME" IS '用户显示名';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_MANAGE"."APP_NAME" IS '智能体名';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_MANAGE"."ACCOUNT_ORG" IS '用户显示单位';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_MANAGE"."ACCOUNT_ORG_FULL" IS '用户显示单位路径';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_MANAGE"."IS_USER_DEFINE" IS '是否自定义 0:否，是';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_MANAGE"."AVATAR" IS '用户头像地址';
COMMENT ON TABLE "KNOWLEDGE"."MODEL_ACCESS_MANAGE" IS '模型API访问管理';

-- ----------------------------
-- TABLE STRUCTURE FOR MODEL_ACCESS_STRATEGY
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."MODEL_ACCESS_STRATEGY";
CREATE TABLE "KNOWLEDGE"."MODEL_ACCESS_STRATEGY" (
  "ID" INT8 NOT NULL,
  "NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TYPE" INT4,
  "STATUS" INT4 NOT NULL,
  "IS_DEFAULT" INT4 DEFAULT 0,
  "IS_USER" INT4,
  "USER_CONCURRENCY" INT4,
  "USER_CONCURRENCY_UNIT" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "IS_MODEL" INT4,
  "MODEL_CONCURRENCY" INT4,
  "MODEL_CONCURRENCY_UNIT" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "IS_MODEL_DEFAULT" INT4,
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 NOT NULL DEFAULT 0,
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(2) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "IS_USER_DEFINE" INT4
)
;
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY"."NAME" IS '策略名称';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY"."TYPE" IS '0-自定义 1-用户 2-智能体 ';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY"."STATUS" IS '状态 0 禁用 1启动';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY"."IS_DEFAULT" IS '是否基础策略 0否 1是';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY"."IS_USER" IS '是否用户策略';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY"."USER_CONCURRENCY" IS '时间数值';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY"."USER_CONCURRENCY_UNIT" IS '时间单位 S MIN H';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY"."IS_MODEL" IS '是否模型策略';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY"."MODEL_CONCURRENCY" IS '模型最大并发数';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY"."MODEL_CONCURRENCY_UNIT" IS '时间单位 S MIN H';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY"."IS_MODEL_DEFAULT" IS '1：启用  ，启用后，该默认最大请求数控制对所有非自定义设置的模型生效';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY"."DELETE_FLAG" IS '删除状态(0:正常 1:删除) ';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY"."UPDATE_NAME" IS '更新人名';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY"."BUREAU_CODE" IS '省编码';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY"."IS_USER_DEFINE" IS '是否用户自定义策略 0：否  1：是';
COMMENT ON TABLE "KNOWLEDGE"."MODEL_ACCESS_STRATEGY" IS '模型访问策略';

-- ----------------------------
-- TABLE STRUCTURE FOR MODEL_ACCESS_STRATEGY_ITEMS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."MODEL_ACCESS_STRATEGY_ITEMS";
CREATE TABLE "KNOWLEDGE"."MODEL_ACCESS_STRATEGY_ITEMS" (
  "ID" INT8 NOT NULL,
  "MODEL_BASE_ID" INT8,
  "CONCURRENCY" INT4,
  "STRATEGY_ID" INT8,
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT2 NOT NULL DEFAULT 0,
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(2) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY_ITEMS"."MODEL_BASE_ID" IS '模型ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY_ITEMS"."CONCURRENCY" IS '并发数';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY_ITEMS"."STRATEGY_ID" IS '策略ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY_ITEMS"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY_ITEMS"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY_ITEMS"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY_ITEMS"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY_ITEMS"."DELETE_FLAG" IS '删除状态(0:正常 1:删除) ';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY_ITEMS"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY_ITEMS"."UPDATE_NAME" IS '更新人名';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY_ITEMS"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY_ITEMS"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY_ITEMS"."BUREAU_CODE" IS '省编码';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ACCESS_STRATEGY_ITEMS"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON TABLE "KNOWLEDGE"."MODEL_ACCESS_STRATEGY_ITEMS" IS '模型访问策略-模型并发控制';

-- ----------------------------
-- TABLE STRUCTURE FOR MODEL_APPLICATION_REL
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."MODEL_APPLICATION_REL";
CREATE TABLE "KNOWLEDGE"."MODEL_APPLICATION_REL" (
  "ID" INT8 NOT NULL,
  "MODEL_BASE_ID" INT8 NOT NULL,
  "MODEL_APPLICATION_ID" INT8 NOT NULL,
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT4 NOT NULL DEFAULT 0,
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(2) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "CLASSIFY" INT4,
  "SORT" INT4
)
;
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_APPLICATION_REL"."MODEL_BASE_ID" IS '模型ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_APPLICATION_REL"."MODEL_APPLICATION_ID" IS '应用ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_APPLICATION_REL"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_APPLICATION_REL"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_APPLICATION_REL"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_APPLICATION_REL"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_APPLICATION_REL"."DELETE_FLAG" IS '删除状态(0:正常 1:删除) ';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_APPLICATION_REL"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_APPLICATION_REL"."UPDATE_NAME" IS '更新人名';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_APPLICATION_REL"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_APPLICATION_REL"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_APPLICATION_REL"."BUREAU_CODE" IS '省编码';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_APPLICATION_REL"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_APPLICATION_REL"."CLASSIFY" IS '模型分类 1底座 2重排 3视觉';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_APPLICATION_REL"."SORT" IS '排序字段';
COMMENT ON TABLE "KNOWLEDGE"."MODEL_APPLICATION_REL" IS '模型应用关联表';

-- ----------------------------
-- TABLE STRUCTURE FOR MODEL_ASSIGN
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."MODEL_ASSIGN";
CREATE TABLE "KNOWLEDGE"."MODEL_ASSIGN" (
  "ID" INT8 NOT NULL,
  "MODEL_BASE_ID" INT8,
  "CLASSIFY" INT4,
  "STATUS" INT4,
  "INDEX" INT4,
  "TYPE" INT4,
  "USER_ACCOUNT" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "APP_ID" INT8,
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT4 NOT NULL DEFAULT 0,
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(2) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "ACCOUNT_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ACCOUNT_ORG" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ACCOUNT_ORG_FULL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "AVATAR" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN"."MODEL_BASE_ID" IS '模型ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN"."CLASSIFY" IS '分类 1底座模型 2重排模型 3视觉模型';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN"."STATUS" IS '状态 0 禁用 1启动';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN"."INDEX" IS '排序字段';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN"."TYPE" IS '1-用户 2智能体';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN"."USER_ACCOUNT" IS '用户账号 TYPE=1时使用';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN"."APP_ID" IS '智能体ID 用户账号 TYPE=2时使用';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN"."DELETE_FLAG" IS '删除状态(0:正常 1:删除) ';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN"."UPDATE_NAME" IS '更新人名';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN"."BUREAU_CODE" IS '省编码';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN"."ACCOUNT_NAME" IS '用户显示名';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN"."ACCOUNT_ORG" IS '用户显示单位';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN"."ACCOUNT_ORG_FULL" IS '用户显示单位路径';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN"."AVATAR" IS '用户头像地址';
COMMENT ON TABLE "KNOWLEDGE"."MODEL_ASSIGN" IS '模型定向分配表';

-- ----------------------------
-- TABLE STRUCTURE FOR MODEL_ASSIGN_REL
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."MODEL_ASSIGN_REL";
CREATE TABLE "KNOWLEDGE"."MODEL_ASSIGN_REL" (
  "ID" INT8 NOT NULL,
  "MODEL_BASE_ID" INT8 NOT NULL,
  "MODEL_ASSIGN_ID" INT8 NOT NULL,
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT4 NOT NULL DEFAULT 0,
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(2) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "CLASSIFY" INT4,
  "SORT" INT4
)
;
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN_REL"."MODEL_BASE_ID" IS '模型ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN_REL"."MODEL_ASSIGN_ID" IS '定向分配ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN_REL"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN_REL"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN_REL"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN_REL"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN_REL"."DELETE_FLAG" IS '删除状态(0:正常 1:删除) ';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN_REL"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN_REL"."UPDATE_NAME" IS '更新人名';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN_REL"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN_REL"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN_REL"."BUREAU_CODE" IS '省编码';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN_REL"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN_REL"."CLASSIFY" IS '模型分类 1底座 2重排 3视觉';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ASSIGN_REL"."SORT" IS '排序字段';
COMMENT ON TABLE "KNOWLEDGE"."MODEL_ASSIGN_REL" IS '模型定向分配关联表';

-- ----------------------------
-- TABLE STRUCTURE FOR MODEL_BASE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."MODEL_BASE";
CREATE TABLE "KNOWLEDGE"."MODEL_BASE" (
  "ID" INT8 NOT NULL,
  "CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "MODEL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TYPE" INT4,
  "NODE_TYPE" INT4,
  "BASE_URL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CONCURRENCY" INT4,
  "STATUS" INT4 DEFAULT 0,
  "DECISION_TYPE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "DEBUG_PARAMS" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CLASSIFY" INT4,
  "INFERENCE_PARAMS" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT4 NOT NULL DEFAULT 0,
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(2) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "PROTOCOL_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "PORT_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "API_PATH" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "MODEL_JSON_CONFIG" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "SYSTEM_PROMPT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "MAX_OUTPUT_TOKEN" INT4 DEFAULT 0,
  "MAX_TOKENS" INT4 DEFAULT 0,
  "SUPPORT_DECISION_PLUGIN" INT4 DEFAULT 1,
  "DEEP_THINKING" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."CODE" IS '模型编号';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."MODEL" IS '模型名称';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."NAME" IS '显示名称';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."TYPE" IS '类型 1-对话 2-深度思考';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."NODE_TYPE" IS '节点类型 1单点 2负载';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."BASE_URL" IS 'PROTOCOL+PORT+APIPATH';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."CONCURRENCY" IS '有效并发';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."STATUS" IS '状态 0 禁用 1启动';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."DECISION_TYPE" IS '意图识别方式：REACT、FUNCTION';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."DEBUG_PARAMS" IS '调试参数';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."CLASSIFY" IS '分类 1底座模型 2重排模型 3视觉模型';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."INFERENCE_PARAMS" IS '推理参数';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."DELETE_FLAG" IS '删除状态(0:正常 1:删除) ';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."UPDATE_NAME" IS '更新人名';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."BUREAU_CODE" IS '省编码';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."PROTOCOL_NAME" IS '协议：HTTPS  / HTTP';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."PORT_NAME" IS '端口 ';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."API_PATH" IS 'API地址';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."MODEL_JSON_CONFIG" IS '调用大模型默认参数/基础输入参数';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."SYSTEM_PROMPT" IS '默认系统提示词';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."MAX_OUTPUT_TOKEN" IS '最大回复上限/最大上下文长度';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."MAX_TOKENS" IS '最大TOKEN数/最大输出长度';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."SUPPORT_DECISION_PLUGIN" IS '意图识别是否支持调用工具（插件工作流）: 1支持';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_BASE"."DEEP_THINKING" IS '深度思考:0是，1否';
COMMENT ON TABLE "KNOWLEDGE"."MODEL_BASE" IS '模型接入管理';

-- ----------------------------
-- TABLE STRUCTURE FOR MODEL_ONLINE_APPLICATION
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."MODEL_ONLINE_APPLICATION";
CREATE TABLE "KNOWLEDGE"."MODEL_ONLINE_APPLICATION" (
  "ID" INT8 NOT NULL,
  "APPLICATION_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "MODEL_BASE_ID" INT8,
  "CLASSIFY" INT8,
  "INDEX" INT4,
  "CREATE_ID" INT8,
  "CREATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_FLAG" INT4 NOT NULL DEFAULT 0,
  "UPDATE_ID" INT8,
  "UPDATE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "APPLICATION_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_ID" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "BUREAU_CODE" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR(2) COLLATE "PG_CATALOG"."DEFAULT",
  "OPTIMISTIC_LOCK_VERSION" INT8,
  "STATUS" INT4 DEFAULT 0
)
;
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ONLINE_APPLICATION"."APPLICATION_NAME" IS '应用名称';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ONLINE_APPLICATION"."MODEL_BASE_ID" IS '模型ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ONLINE_APPLICATION"."CLASSIFY" IS '模型分类 1底座 2重排 3视觉';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ONLINE_APPLICATION"."INDEX" IS '排序字段';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ONLINE_APPLICATION"."CREATE_ID" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ONLINE_APPLICATION"."CREATE_NAME" IS '创建人名称';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ONLINE_APPLICATION"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ONLINE_APPLICATION"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ONLINE_APPLICATION"."DELETE_FLAG" IS '删除状态(0:正常 1:删除) ';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ONLINE_APPLICATION"."UPDATE_ID" IS '更新人ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ONLINE_APPLICATION"."UPDATE_NAME" IS '更新人名';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ONLINE_APPLICATION"."APPLICATION_CODE" IS '应用编号';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ONLINE_APPLICATION"."ORG_ID" IS '组织ID';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ONLINE_APPLICATION"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ONLINE_APPLICATION"."BUREAU_CODE" IS '省编码';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ONLINE_APPLICATION"."OPTIMISTIC_LOCK_VERSION" IS '乐观锁版本';
COMMENT ON COLUMN "KNOWLEDGE"."MODEL_ONLINE_APPLICATION"."STATUS" IS '0：禁用    1：启用';
COMMENT ON TABLE "KNOWLEDGE"."MODEL_ONLINE_APPLICATION" IS '模型上线应用';

-- ----------------------------
-- TABLE STRUCTURE FOR OPEN_APP_APPROVAL_PROGRESS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."OPEN_APP_APPROVAL_PROGRESS";
CREATE TABLE "KNOWLEDGE"."OPEN_APP_APPROVAL_PROGRESS" (
  "ID" INT8 NOT NULL,
  "OPEN_APP_ID" INT8,
  "STAGE" INT8,
  "REASON" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_BY" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATED_TIME" TIMESTAMP(6)
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR OPEN_APP_COMPONENTS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."OPEN_APP_COMPONENTS";
CREATE TABLE "KNOWLEDGE"."OPEN_APP_COMPONENTS" (
  "ID" INT8 NOT NULL,
  "REL_ID" INT8 NOT NULL,
  "OPEN_APP_ID" INT8 NOT NULL,
  "TYPE" INT2,
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "VERSION" INT4,
  "DELETE_TIME" TIMESTAMP(6),
  "NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CUSTOMER_CODE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APP_COMPONENTS"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APP_COMPONENTS"."REL_ID" IS '关联组件ID，插件ID/工作流ID/知识库ID/智能体ID';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APP_COMPONENTS"."OPEN_APP_ID" IS '开放应用ID';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APP_COMPONENTS"."TYPE" IS '组件类型';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APP_COMPONENTS"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APP_COMPONENTS"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APP_COMPONENTS"."VERSION" IS '版本号';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APP_COMPONENTS"."DELETE_TIME" IS '删除时间';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APP_COMPONENTS"."NAME" IS '组件名称';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APP_COMPONENTS"."CUSTOMER_CODE" IS '组件编码';
COMMENT ON TABLE "KNOWLEDGE"."OPEN_APP_COMPONENTS" IS '开放组件';

-- ----------------------------
-- TABLE STRUCTURE FOR OPEN_APP_FILES
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."OPEN_APP_FILES";
CREATE TABLE "KNOWLEDGE"."OPEN_APP_FILES" (
  "ID" INT8 NOT NULL,
  "OPEN_APP_ID" INT8,
  "STATUS" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_NAME" VARCHAR(3000) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_TYPE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_URL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_SIZE" INT8,
  "FILE_MD5" VARCHAR(3000) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_SYSTEM_TYPE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_BUCKET" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_BY" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATED_TIME" TIMESTAMP(6),
  "UPDATE_BY" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6)
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR OPEN_APP_WHITE_LIST
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."OPEN_APP_WHITE_LIST";
CREATE TABLE "KNOWLEDGE"."OPEN_APP_WHITE_LIST" (
  "ID" INT8 NOT NULL,
  "OPEN_APP_ID" INT8 NOT NULL,
  "HOST" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "DELETE_TIME" TIMESTAMP(6)
)
;
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APP_WHITE_LIST"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APP_WHITE_LIST"."OPEN_APP_ID" IS '开放应用ID';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APP_WHITE_LIST"."HOST" IS '白名单地址，域名/IP+端口';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APP_WHITE_LIST"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APP_WHITE_LIST"."UPDATE_TIME" IS '修改时间';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APP_WHITE_LIST"."DELETE_TIME" IS '删除时间';
COMMENT ON TABLE "KNOWLEDGE"."OPEN_APP_WHITE_LIST" IS '开放应用白名单';

-- ----------------------------
-- TABLE STRUCTURE FOR OPEN_APPS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."OPEN_APPS";
CREATE TABLE "KNOWLEDGE"."OPEN_APPS" (
  "ID" INT8 NOT NULL,
  "TYPE" INT4,
  "NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "STATUS" INT2 DEFAULT 0,
  "KEY" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "EXPIRE_TIME" TIMESTAMP(6),
  "DELETE_TIME" TIMESTAMP(6),
  "CREATE_USER" INT8,
  "START_TIME" TIMESTAMP(6),
  "REASON" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "APPROVAL_STATUS" INT2,
  "DOWNLOAD_KEY" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "CUSTOMER_CODE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "APPS_EXPIRE_TIME" TIMESTAMP(6),
  "DATASET_EXPIRE_TIME" TIMESTAMP(6),
  "EFFECTIVE_STATUS" INT4 DEFAULT 1,
  "PROVINCE_CODE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_NAME" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APPS"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APPS"."TYPE" IS '应用类型';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APPS"."NAME" IS '名称';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APPS"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APPS"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APPS"."STATUS" IS '启用状态';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APPS"."KEY" IS '应用KEY';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APPS"."EXPIRE_TIME" IS '过期时间';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APPS"."DELETE_TIME" IS '删除时间';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APPS"."CREATE_USER" IS '用户ID';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APPS"."START_TIME" IS '开始时间';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APPS"."REASON" IS '申请原因';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APPS"."APPROVAL_STATUS" IS '审批状态';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APPS"."DOWNLOAD_KEY" IS '下载KEY';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APPS"."CUSTOMER_CODE" IS '飞轮客户系统编码';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APPS"."APPS_EXPIRE_TIME" IS '智能体过期时间';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APPS"."DATASET_EXPIRE_TIME" IS '知识库过期时间';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APPS"."EFFECTIVE_STATUS" IS '是否有效。1-是，0-否';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APPS"."PROVINCE_CODE" IS '二级单位编码';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_APPS"."PROVINCE_NAME" IS '二级单位名称';
COMMENT ON TABLE "KNOWLEDGE"."OPEN_APPS" IS '开放应用';

-- ----------------------------
-- TABLE STRUCTURE FOR OPEN_CALL_STATISTICS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."OPEN_CALL_STATISTICS";
CREATE TABLE "KNOWLEDGE"."OPEN_CALL_STATISTICS" (
  "APP_ID" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "PUBLIC_ID" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "CALL_TYPE" INT4 NOT NULL,
  "IP_ADDER" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TITLE" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CONTENT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "START_TIME" TIMESTAMP(6),
  "USER_AGENT" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "RESP_TIME" TIMESTAMP(6),
  "END_TIME" TIMESTAMP(6),
  "AGENT_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "AGENT_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "WORKFLOW_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "WORKFLOW_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ACCOUNT_ID" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ACCOUNT_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "INPUT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "OUTPUT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "CREATE_USER" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "INPUT_TOKENS" INT4,
  "OUTPUT_TOKENS" INT4,
  "APP_NAME" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "MODEL_NAME" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "FIRST_TOKEN_COST" INT4,
  "CUST_SYS_CODE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "AGENT_VERSION" VARCHAR(16) COLLATE "PG_CATALOG"."DEFAULT",
  "INTERFACE_CALL_TYPE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "INTERFACE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "REQ_URL" VARCHAR(300) COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_NAME" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "TOTAL_TOKENS" INT8,
  "TOTAL_TIME" INT8,
  "RES_STATUS" VARCHAR(16) COLLATE "PG_CATALOG"."DEFAULT",
  "ERROR_MESSAGES" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "PROVINCE_CODE" VARCHAR COLLATE "PG_CATALOG"."DEFAULT",
  "ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."APP_ID" IS '应用ID-凭证ID';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."PUBLIC_ID" IS '智能体ID、插件ID、工作流ID、知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."CALL_TYPE" IS '调用类别 1-智能体，2-插件，4-工作流，3-知识库';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."IP_ADDER" IS '访问IP地址';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."TITLE" IS '问题';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."CONTENT" IS '答案';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."START_TIME" IS '请求时间';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."USER_AGENT" IS '浏览器请求相关';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."RESP_TIME" IS '响应时间 大模型第一次回复时间';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."END_TIME" IS '请求结束时间';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."AGENT_ID" IS '智能体ID/知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."AGENT_NAME" IS '智能体名称/知识库名称';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."WORKFLOW_ID" IS '关联工作流ID';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."WORKFLOW_NAME" IS '关联工作流名称';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."ACCOUNT_ID" IS '用户账号';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."ACCOUNT_NAME" IS '用户名';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."INPUT" IS '入参';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."OUTPUT" IS '返参';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."INPUT_TOKENS" IS '大模型输入TOKEN';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."OUTPUT_TOKENS" IS '大模型输出TOKEN';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."APP_NAME" IS '应用名称';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."MODEL_NAME" IS '模型名称';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."ORG_NAME" IS '机构名称';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."FIRST_TOKEN_COST" IS '首字吐字时间';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."CUST_SYS_CODE" IS '客户系统编码';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."AGENT_VERSION" IS '知识库版本/智能体版本';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."INTERFACE_CALL_TYPE" IS '接口调用类型';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."INTERFACE_NAME" IS '接口名称';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."REQ_URL" IS '请求路径';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."PROVINCE_NAME" IS '二级单位全称';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."TOTAL_TOKENS" IS '总TOKEN数量';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."TOTAL_TIME" IS '总耗时';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."RES_STATUS" IS '调用结果状态 SUCCESS，ERROR';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."ERROR_MESSAGES" IS '调用错误原因';
COMMENT ON COLUMN "KNOWLEDGE"."OPEN_CALL_STATISTICS"."PROVINCE_CODE" IS '二级单位编码';

-- ----------------------------
-- TABLE STRUCTURE FOR PLATFORM_INFO
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."PLATFORM_INFO";
CREATE TABLE "KNOWLEDGE"."PLATFORM_INFO" (
  "ID" INT8 NOT NULL,
  "PLATFORM_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PLATFORM_TYPE" INT4,
  "PLATFORM_DESC" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PLATFORM_TYPE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."PLATFORM_INFO"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."PLATFORM_INFO"."PLATFORM_NAME" IS '平台名称';
COMMENT ON COLUMN "KNOWLEDGE"."PLATFORM_INFO"."PLATFORM_TYPE" IS '平台类型 ：1：智能体平台 2：API';
COMMENT ON COLUMN "KNOWLEDGE"."PLATFORM_INFO"."PLATFORM_DESC" IS '平台描述';
COMMENT ON COLUMN "KNOWLEDGE"."PLATFORM_INFO"."PLATFORM_TYPE_NAME" IS '平台类型名称';

-- ----------------------------
-- TABLE STRUCTURE FOR PLUGIN_APP
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."PLUGIN_APP";
CREATE TABLE "KNOWLEDGE"."PLUGIN_APP" (
  "PLUGIN_APP_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_DESC" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_URL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "TYPE" INT4,
  "PLUGIN_ICON" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "AUTH_TYPE" INT4,
  "AUTH_PARAMS" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "RELEASE_STATUS" INT4 DEFAULT 1,
  "USER_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "USER_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "MODULE" VARCHAR(60000) COLLATE "PG_CATALOG"."DEFAULT",
  "PROJECT_ID" INT8,
  "PLUGIN_TYPE" INT8,
  "PLUGIN_DIR_ID" INT8,
  "PLUGIN_PACKAGE_TYPE" INT4,
  "PLUGIN_KEYWORD" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_DIR_KIND_ID" INT8,
  "PLUGIN_SOURCE_URL" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_SOURCE_TYPE" INT4,
  "PLUGIN_SOURCE_DETAIL_URL" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "AVATAR" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "SMART_LABEL_ID" INT2,
  "VERSION_RELEASE" INT4 DEFAULT 1,
  "AGENT_TEAM_ID" INT8,
  "WORKFLOW_TYPE" INT4,
  "IS_SHARE" INT4 DEFAULT 0,
  "FUN_CODE" INT4,
  "CANCEL_USER_ID" INT8,
  "CANCEL_REASON" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "CANCEL_TIME" TIMESTAMP(6),
  "CANCEL_PAGE" INT4 DEFAULT 1
)
;
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP"."TYPE" IS '0-API;1-工作流';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP"."RELEASE_STATUS" IS '状态：1:已发布，2：已下线';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP"."PROJECT_ID" IS '项目ID';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP"."PLUGIN_TYPE" IS '插件类型：0系统内置插件/1外部接入插件/2平台开发插件';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP"."PLUGIN_DIR_ID" IS '插件目录';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP"."PLUGIN_PACKAGE_TYPE" IS '插件集合类型:1：插件源 （历史数据默认该集合）2：插件';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP"."PLUGIN_KEYWORD" IS '关键词';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP"."PLUGIN_DIR_KIND_ID" IS '插件目录分类';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP"."PLUGIN_SOURCE_URL" IS '插件来源API工具地址';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP"."PLUGIN_SOURCE_TYPE" IS '插件来源类型：1，数据源；2 API';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP"."PLUGIN_SOURCE_DETAIL_URL" IS '插件来源API工具详情';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP"."AVATAR" IS 'LOGO路径';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP"."SMART_LABEL_ID" IS '标签ID';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP"."VERSION_RELEASE" IS '版本号';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP"."AGENT_TEAM_ID" IS '平台团队ID';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP"."WORKFLOW_TYPE" IS '工作流类型';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP"."IS_SHARE" IS '是否共享(1:是；0:否 ;2:取消共享)';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP"."FUN_CODE" IS '功能标签编码LM_AGENT_FUN_LABEL';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP"."CANCEL_USER_ID" IS '取消共享人';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP"."CANCEL_REASON" IS '取消共享原因';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP"."CANCEL_TIME" IS '取消共享时间';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP"."CANCEL_PAGE" IS '取消页面：1：本人/团队 2：运营管理员';

-- ----------------------------
-- TABLE STRUCTURE FOR PLUGIN_APP_DIR
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."PLUGIN_APP_DIR";
CREATE TABLE "KNOWLEDGE"."PLUGIN_APP_DIR" (
  "DIR_ID" INT8 NOT NULL,
  "DIR_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "DIR_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "DIR_TYPE" INT4,
  "PARENT_DIR_ID" INT8,
  "PATH_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_BY" INT8,
  "CREATE_DATE" TIMESTAMP(6),
  "UPDATE_BY" INT8,
  "UPDATE_DATE" TIMESTAMP(6),
  "COM_ACCT_ID" INT8
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR PLUGIN_APP_FIX_GUESS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS";
CREATE TABLE "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS" (
  "FIX_ID" INT8 NOT NULL,
  "APP_ID" INT8,
  "INFO_TYPE" INT4,
  "INFO_TITLE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "GUESS_TYPE" INT4,
  "INFO_CONTENT" VARCHAR(1024) COLLATE "PG_CATALOG"."DEFAULT",
  "AVATAR" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "CURRENT_USE" INT4,
  "PLUGIN_APP" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_TYPE" INT4,
  "VERSION_RELEASE" INT4 DEFAULT 1
)
;
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS"."FIX_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS"."APP_ID" IS '应用ID';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS"."INFO_TYPE" IS '信息类型：1，介绍；2，猜你想问 4:开场白 5：推荐问题';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS"."INFO_TITLE" IS '头部标题';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS"."GUESS_TYPE" IS '猜你想问类型：1，问库表；2问代码；3问报表；4：问口径；5操作指引；6：运维知识';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS"."INFO_CONTENT" IS '内容';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS"."AVATAR" IS 'LOGO地址';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS"."CURRENT_USE" IS '是否当前使用：1是，0否';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS"."PLUGIN_APP" IS '工作流ID';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS"."PLUGIN_TYPE" IS '工作流插件类型';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS"."VERSION_RELEASE" IS '版本号';

-- ----------------------------
-- TABLE STRUCTURE FOR PLUGIN_APP_FIX_GUESS_RELEASE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS_RELEASE";
CREATE TABLE "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS_RELEASE" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "FIX_ID" INT8 NOT NULL,
  "APP_ID" INT8,
  "INFO_TYPE" INT4,
  "INFO_TITLE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "GUESS_TYPE" INT4,
  "INFO_CONTENT" VARCHAR(1024) COLLATE "PG_CATALOG"."DEFAULT",
  "AVATAR" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "CURRENT_USE" INT4,
  "PLUGIN_APP" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_TYPE" INT4,
  "VERSION_RELEASE" INT4 DEFAULT 1
)
;
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS_RELEASE"."FIX_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS_RELEASE"."APP_ID" IS '应用ID';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS_RELEASE"."INFO_TYPE" IS '信息类型：1，介绍；2，猜你想问 4:开场白 5：推荐问题';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS_RELEASE"."INFO_TITLE" IS '头部标题';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS_RELEASE"."GUESS_TYPE" IS '猜你想问类型：1，问库表；2问代码；3问报表；4：问口径；5操作指引；6：运维知识';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS_RELEASE"."INFO_CONTENT" IS '内容';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS_RELEASE"."AVATAR" IS 'LOGO地址';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS_RELEASE"."CURRENT_USE" IS '是否当前使用：1是，0否';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS_RELEASE"."PLUGIN_APP" IS '工作流ID';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS_RELEASE"."PLUGIN_TYPE" IS '工作流插件类型';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS_RELEASE"."VERSION_RELEASE" IS '版本号';

-- ----------------------------
-- TABLE STRUCTURE FOR PLUGIN_APP_PLUGINTYPE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."PLUGIN_APP_PLUGINTYPE";
CREATE TABLE "KNOWLEDGE"."PLUGIN_APP_PLUGINTYPE" (
  "PLUGIN_APP_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_DESC" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_URL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "TYPE" INT4,
  "PLUGIN_TYPE" INT8,
  "PLUGIN_ICON" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "AUTH_TYPE" INT4,
  "AUTH_PARAMS" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "RELEASE_STATUS" INT4,
  "USER_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "USER_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "MODULE" VARCHAR(50000) COLLATE "PG_CATALOG"."DEFAULT"
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR PLUGIN_APP_RELEASE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."PLUGIN_APP_RELEASE";
CREATE TABLE "KNOWLEDGE"."PLUGIN_APP_RELEASE" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "PLUGIN_APP_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_DESC" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_URL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "TYPE" INT4,
  "PLUGIN_ICON" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "AUTH_TYPE" INT4,
  "AUTH_PARAMS" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "RELEASE_STATUS" INT4 DEFAULT 1,
  "USER_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "USER_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "MODULE" VARCHAR(60000) COLLATE "PG_CATALOG"."DEFAULT",
  "PROJECT_ID" INT8,
  "PLUGIN_TYPE" INT8,
  "PLUGIN_DIR_ID" INT8,
  "PLUGIN_PACKAGE_TYPE" INT4,
  "PLUGIN_KEYWORD" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_DIR_KIND_ID" INT8,
  "PLUGIN_SOURCE_URL" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_SOURCE_TYPE" INT4,
  "PLUGIN_SOURCE_DETAIL_URL" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "AVATAR" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "SMART_LABEL_ID" INT2,
  "VERSION_RELEASE" INT4 DEFAULT 1,
  "AGENT_TEAM_ID" INT8,
  "IS_SHARE" INT4 DEFAULT 0,
  "WORKFLOW_TYPE" INT4,
  "FUN_CODE" INT4,
  "CANCEL_USER_ID" INT8,
  "CANCEL_REASON" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "CANCEL_TIME" TIMESTAMP(6),
  "CANCEL_PAGE" INT4 DEFAULT 1
)
;
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."ID" IS '主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."PLUGIN_APP_ID" IS 'PLUGIN_APP';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."TYPE" IS '0-API;1-工作流';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."RELEASE_STATUS" IS '状态：1:已发布，2：已下线';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."PROJECT_ID" IS '项目ID';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."PLUGIN_TYPE" IS '插件类型：0系统内置插件/1外部接入插件/2平台开发插件';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."PLUGIN_DIR_ID" IS '插件目录';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."PLUGIN_PACKAGE_TYPE" IS '插件集合类型:1：插件源 （历史数据默认该集合）2：插件';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."PLUGIN_KEYWORD" IS '关键词';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."PLUGIN_DIR_KIND_ID" IS '插件目录分类';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."PLUGIN_SOURCE_URL" IS '插件来源API工具地址';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."PLUGIN_SOURCE_TYPE" IS '插件来源类型：1，数据源；2 API';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."PLUGIN_SOURCE_DETAIL_URL" IS '插件来源API工具详情';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."AVATAR" IS 'LOGO路径';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."SMART_LABEL_ID" IS '标签ID';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."VERSION_RELEASE" IS '版本号';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."AGENT_TEAM_ID" IS '平台团队ID';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."IS_SHARE" IS '是否共享(1:是；0:否 ;2:取消共享)';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."WORKFLOW_TYPE" IS '工作流类型';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."FUN_CODE" IS '功能标签编码LM_AGENT_FUN_LABEL';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."CANCEL_USER_ID" IS '取消共享人';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."CANCEL_REASON" IS '取消共享原因';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."CANCEL_TIME" IS '取消共享时间';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_APP_RELEASE"."CANCEL_PAGE" IS '取消页面：1：本人/团队 2：运营管理员';

-- ----------------------------
-- TABLE STRUCTURE FOR PLUGIN_HEADER
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."PLUGIN_HEADER";
CREATE TABLE "KNOWLEDGE"."PLUGIN_HEADER" (
  "PLUGIN_HEADER_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_APP_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "HEADER_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "HEADER_VALUE" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "TYPE" INT4 DEFAULT 0,
  "METHOD_TYPE" INT4,
  "HEADER_DESCRIPTION" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "VERSION_RELEASE" INT4 DEFAULT 1,
  "INPUT_VALUE_TYPE" INT4,
  "EXECUTE_SCRIPT_TYPE" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "EXECUTE_SCRIPT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "AUTHORIZE_TYPE" VARCHAR COLLATE "PG_CATALOG"."DEFAULT" DEFAULT 1
)
;
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_HEADER"."TYPE" IS '类型 0 HEADER 1: 固定参数';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_HEADER"."HEADER_DESCRIPTION" IS '参数描述';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_HEADER"."VERSION_RELEASE" IS '版本号';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_HEADER"."INPUT_VALUE_TYPE" IS '输入类型 0.手动输入 1.生成输入';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_HEADER"."EXECUTE_SCRIPT_TYPE" IS '执行脚本类型 PYTHON、JS、JAVA';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_HEADER"."EXECUTE_SCRIPT" IS '执行的脚本';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_HEADER"."AUTHORIZE_TYPE" IS '授权方式(1.无需授权,2.TOKEN授权)';

-- ----------------------------
-- TABLE STRUCTURE FOR PLUGIN_HEADER_RELEASE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."PLUGIN_HEADER_RELEASE";
CREATE TABLE "KNOWLEDGE"."PLUGIN_HEADER_RELEASE" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "PLUGIN_HEADER_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_APP_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "HEADER_CODE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "HEADER_VALUE" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "TYPE" INT4 DEFAULT 0,
  "METHOD_TYPE" INT4,
  "HEADER_DESCRIPTION" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "VERSION_RELEASE" INT4 DEFAULT 1,
  "INPUT_VALUE_TYPE" INT4,
  "EXECUTE_SCRIPT_TYPE" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "EXECUTE_SCRIPT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "AUTHORIZE_TYPE" VARCHAR COLLATE "PG_CATALOG"."DEFAULT" DEFAULT '1'::CHARACTER VARYING
)
;
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_HEADER_RELEASE"."ID" IS '主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_HEADER_RELEASE"."PLUGIN_HEADER_ID" IS 'PLUGIN_HEADER表 ID';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_HEADER_RELEASE"."PLUGIN_APP_ID" IS 'PLUGIN_APP_RELEASE 表 ID';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_HEADER_RELEASE"."TYPE" IS '类型 0 HEADER 1: 固定参数';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_HEADER_RELEASE"."HEADER_DESCRIPTION" IS '参数描述';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_HEADER_RELEASE"."VERSION_RELEASE" IS '版本号';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_HEADER_RELEASE"."INPUT_VALUE_TYPE" IS '输入类型 0.手动输入 1.生成输入';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_HEADER_RELEASE"."EXECUTE_SCRIPT_TYPE" IS '执行脚本类型 PYTHON、JS、JAVA';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_HEADER_RELEASE"."EXECUTE_SCRIPT" IS '执行的脚本';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_HEADER_RELEASE"."AUTHORIZE_TYPE" IS '授权方式(1.无需授权,2.TOKEN授权)';

-- ----------------------------
-- TABLE STRUCTURE FOR PLUGIN_MACHINE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."PLUGIN_MACHINE";
CREATE TABLE "KNOWLEDGE"."PLUGIN_MACHINE" (
  "PLUGIN_MACHINE_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_APP_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "MACHINE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "MACHINE_DESC" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "MACHINE_URL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TYPE" INT4,
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "DEBUG_STATUS" INT4,
  "IS_USE" INT2,
  "BODY_TYPE" INT8,
  "VERSION" INT4,
  "PLUGIN_SUB_TYPE" INT4,
  "CODE_TYPE" INT4,
  "APP_TYPE" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "MODULE" VARCHAR(50000) COLLATE "PG_CATALOG"."DEFAULT",
  "SCRIPT_PATH" VARCHAR(2000) COLLATE "PG_CATALOG"."DEFAULT",
  "SCRIPT_KIND" INT4,
  "SCRIPT_LANGUAGE" VARCHAR(256) COLLATE "PG_CATALOG"."DEFAULT",
  "STATUS" INT4,
  "SCRIPT_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "VERSION_RELEASE" INT4 DEFAULT 1,
  "AGENT_TEAM_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE"."BODY_TYPE" IS '脚本语言';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE"."VERSION" IS '版本标识';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE"."PLUGIN_SUB_TYPE" IS '插件子类型';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE"."CODE_TYPE" IS '编排方式';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE"."APP_TYPE" IS '应用类型';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE"."MODULE" IS '低代码版本';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE"."SCRIPT_PATH" IS '脚本路径';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE"."STATUS" IS '状态:1：已发布，2：已下线';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE"."SCRIPT_ID" IS '脚本ID';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE"."VERSION_RELEASE" IS '版本号';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE"."AGENT_TEAM_ID" IS '平台团队ID';

-- ----------------------------
-- TABLE STRUCTURE FOR PLUGIN_MACHINE_FIELD
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."PLUGIN_MACHINE_FIELD";
CREATE TABLE "KNOWLEDGE"."PLUGIN_MACHINE_FIELD" (
  "MACHINE_FIELD_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "MACHINE_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "FIELD_TYPE" INT4 DEFAULT 0,
  "FIELD_DESC" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "IN_OUT_TYPE" INT2,
  "REQUEST_TYPE" INT2,
  "FIELD_PARENT_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "IS_REQUIRED" INT2,
  "FIELD_CODE" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "GLOSSARY_TYPE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "DATASET_ID" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_ID" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "ENTITY_RANGE" VARCHAR(2000) COLLATE "PG_CATALOG"."DEFAULT",
  "REMARK" VARCHAR(256) COLLATE "PG_CATALOG"."DEFAULT",
  "FIELD_ALIAS" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "FILTER_GLOSSARY_TYPE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "FILTER_DATASET_ID" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "FILTER_FILE_ID" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "FILTER_ENTITY" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "VERSION_RELEASE" INT4 DEFAULT 1,
  "AGENT_TEAM_ID" INT8,
  "FIELD_VALUE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD"."FIELD_TYPE" IS '数据类型，如STRING、OBJECT等';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD"."IN_OUT_TYPE" IS '0：入参，1：出参';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD"."FIELD_CODE" IS '出参字段JSON';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD"."GLOSSARY_TYPE" IS '术语类型。1.概念；2.实体';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD"."DATASET_ID" IS '知识库。多个时用逗号分隔。';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD"."FILE_ID" IS '文件。多个时用逗号分隔。';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD"."ENTITY_RANGE" IS '存储哪些概念的实体。';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD"."REMARK" IS 'PARAMCONTENT内容';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD"."FIELD_ALIAS" IS '字段别名';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD"."FILTER_GLOSSARY_TYPE" IS '术语类型。1.概念；2.实体';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD"."FILTER_DATASET_ID" IS '知识库。多个时用逗号分隔。';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD"."FILTER_FILE_ID" IS '文件。多个时用逗号分隔。';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD"."VERSION_RELEASE" IS '版本号';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD"."AGENT_TEAM_ID" IS '平台团队ID';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD"."FIELD_VALUE" IS '字段默认值';

-- ----------------------------
-- TABLE STRUCTURE FOR PLUGIN_MACHINE_FIELD_RELEASE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."PLUGIN_MACHINE_FIELD_RELEASE";
CREATE TABLE "KNOWLEDGE"."PLUGIN_MACHINE_FIELD_RELEASE" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "MACHINE_FIELD_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "MACHINE_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "FIELD_TYPE" INT4 DEFAULT 0,
  "FIELD_DESC" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "IN_OUT_TYPE" INT2,
  "REQUEST_TYPE" INT2,
  "FIELD_PARENT_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "IS_REQUIRED" INT2,
  "FIELD_CODE" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "GLOSSARY_TYPE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "DATASET_ID" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_ID" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "ENTITY_RANGE" VARCHAR(2000) COLLATE "PG_CATALOG"."DEFAULT",
  "REMARK" VARCHAR(256) COLLATE "PG_CATALOG"."DEFAULT",
  "FIELD_ALIAS" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "FILTER_GLOSSARY_TYPE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "FILTER_DATASET_ID" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "FILTER_FILE_ID" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "FILTER_ENTITY" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "VERSION_RELEASE" INT4 DEFAULT 1,
  "AGENT_TEAM_ID" INT8,
  "FIELD_VALUE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD_RELEASE"."ID" IS 'PLUGIN_MACHINE_FIELD 表ID';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD_RELEASE"."FIELD_TYPE" IS '数据类型，如STRING、OBJECT等';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD_RELEASE"."FIELD_CODE" IS '出参字段JSON';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD_RELEASE"."GLOSSARY_TYPE" IS '术语类型。1.概念；2.实体';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD_RELEASE"."DATASET_ID" IS '知识库。多个时用逗号分隔。';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD_RELEASE"."FILE_ID" IS '文件。多个时用逗号分隔。';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD_RELEASE"."ENTITY_RANGE" IS '存储哪些概念的实体。';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD_RELEASE"."REMARK" IS 'PARAMCONTENT内容';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD_RELEASE"."FIELD_ALIAS" IS '字段别名';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD_RELEASE"."FILTER_GLOSSARY_TYPE" IS '术语类型。1.概念；2.实体';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD_RELEASE"."FILTER_DATASET_ID" IS '知识库。多个时用逗号分隔。';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD_RELEASE"."FILTER_FILE_ID" IS '文件。多个时用逗号分隔。';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD_RELEASE"."VERSION_RELEASE" IS '版本号';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_FIELD_RELEASE"."AGENT_TEAM_ID" IS '平台团队ID';

-- ----------------------------
-- TABLE STRUCTURE FOR PLUGIN_MACHINE_LOG
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."PLUGIN_MACHINE_LOG";
CREATE TABLE "KNOWLEDGE"."PLUGIN_MACHINE_LOG" (
  "MACHINE_LOG_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "MACHINE_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "INPUT_VALUES" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "OUTPUT_VALUES" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "APP_ID" INT4,
  "CREATE_TIME" TIMESTAMP(6)
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR PLUGIN_MACHINE_RELEASE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."PLUGIN_MACHINE_RELEASE";
CREATE TABLE "KNOWLEDGE"."PLUGIN_MACHINE_RELEASE" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "PLUGIN_MACHINE_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_APP_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "MACHINE_NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "MACHINE_DESC" VARCHAR(1000) COLLATE "PG_CATALOG"."DEFAULT",
  "MACHINE_URL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TYPE" INT4,
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "UPDATE_TIME" TIMESTAMP(6),
  "DEBUG_STATUS" INT4,
  "IS_USE" INT2,
  "BODY_TYPE" INT8,
  "VERSION" INT4,
  "PLUGIN_SUB_TYPE" INT4,
  "CODE_TYPE" INT4,
  "APP_TYPE" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "MODULE" VARCHAR(50000) COLLATE "PG_CATALOG"."DEFAULT",
  "SCRIPT_PATH" VARCHAR(2000) COLLATE "PG_CATALOG"."DEFAULT",
  "SCRIPT_KIND" INT4,
  "SCRIPT_LANGUAGE" VARCHAR(256) COLLATE "PG_CATALOG"."DEFAULT",
  "STATUS" INT4,
  "SCRIPT_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "VERSION_RELEASE" INT4 DEFAULT 1,
  "AGENT_TEAM_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_RELEASE"."ID" IS '主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_RELEASE"."PLUGIN_MACHINE_ID" IS 'PLUGIN_MACHINE表ID';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_RELEASE"."BODY_TYPE" IS '脚本语言';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_RELEASE"."VERSION" IS '版本标识';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_RELEASE"."PLUGIN_SUB_TYPE" IS '插件子类型';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_RELEASE"."CODE_TYPE" IS '编排方式';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_RELEASE"."APP_TYPE" IS '应用类型';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_RELEASE"."MODULE" IS '低代码版本';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_RELEASE"."SCRIPT_PATH" IS '脚本路径';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_RELEASE"."STATUS" IS '状态:1：已发布，2：已下线';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_RELEASE"."SCRIPT_ID" IS '脚本ID';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_RELEASE"."VERSION_RELEASE" IS '版本号';
COMMENT ON COLUMN "KNOWLEDGE"."PLUGIN_MACHINE_RELEASE"."AGENT_TEAM_ID" IS '平台团队ID';

-- ----------------------------
-- TABLE STRUCTURE FOR PLUGIN_RPA
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."PLUGIN_RPA";
CREATE TABLE "KNOWLEDGE"."PLUGIN_RPA" (
  "RPA_PARAM" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6),
  "RPA_STATUS" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR PROJECT
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."PROJECT";
CREATE TABLE "KNOWLEDGE"."PROJECT" (
  "PROJECT_ID" INT8 NOT NULL,
  "TEAM_ID" INT8,
  "PROJECT_CODE" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "PROJECT_NAME" VARCHAR(50) COLLATE "PG_CATALOG"."DEFAULT",
  "PROJECT_DESC" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_USER_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "PROJECT_ADMIN" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."PROJECT"."PROJECT_ID" IS '项目ID';
COMMENT ON COLUMN "KNOWLEDGE"."PROJECT"."TEAM_ID" IS '团队ID';
COMMENT ON COLUMN "KNOWLEDGE"."PROJECT"."PROJECT_CODE" IS '项目编码';
COMMENT ON COLUMN "KNOWLEDGE"."PROJECT"."PROJECT_NAME" IS '项目名称';
COMMENT ON COLUMN "KNOWLEDGE"."PROJECT"."PROJECT_DESC" IS '项目描述';
COMMENT ON COLUMN "KNOWLEDGE"."PROJECT"."CREATE_USER_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."PROJECT"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."PROJECT"."PROJECT_ADMIN" IS '项目负责人';

-- ----------------------------
-- TABLE STRUCTURE FOR PROJECT_MEMBER
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."PROJECT_MEMBER";
CREATE TABLE "KNOWLEDGE"."PROJECT_MEMBER" (
  "RELA_ID" INT8 NOT NULL,
  "PROJECT_ID" INT8,
  "USER_ID" INT8,
  "IS_PROJECT_ADMIN" INT8,
  "JOIN_TIME" TIMESTAMP(6),
  "STATUS_CD" INT4,
  "LEAVE_TIME" TIMESTAMP(6)
)
;
COMMENT ON COLUMN "KNOWLEDGE"."PROJECT_MEMBER"."RELA_ID" IS '关系ID';
COMMENT ON COLUMN "KNOWLEDGE"."PROJECT_MEMBER"."PROJECT_ID" IS '项目ID';
COMMENT ON COLUMN "KNOWLEDGE"."PROJECT_MEMBER"."USER_ID" IS '用户ID';
COMMENT ON COLUMN "KNOWLEDGE"."PROJECT_MEMBER"."IS_PROJECT_ADMIN" IS '是否是项目管理员';
COMMENT ON COLUMN "KNOWLEDGE"."PROJECT_MEMBER"."JOIN_TIME" IS '加入时间';
COMMENT ON COLUMN "KNOWLEDGE"."PROJECT_MEMBER"."STATUS_CD" IS '状态:0：无效1：有效';
COMMENT ON COLUMN "KNOWLEDGE"."PROJECT_MEMBER"."LEAVE_TIME" IS '删除时间，做逻辑删除，将状态修改为“0：无效';

-- ----------------------------
-- TABLE STRUCTURE FOR PROMPT_TEMPLATE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."PROMPT_TEMPLATE";
CREATE TABLE "KNOWLEDGE"."PROMPT_TEMPLATE" (
  "TEMPLATE_ID" INT8 NOT NULL,
  "TEMPLATE_TYPE" VARCHAR(10) COLLATE "PG_CATALOG"."DEFAULT",
  "TEMPLATE_STATEMENT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "TEMPLATE_STATEMENT_TYPE" VARCHAR(10) COLLATE "PG_CATALOG"."DEFAULT",
  "TEMPLATE_STATE" VARCHAR(10) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_BY" INT8,
  "UPDATE_BY" INT8,
  "CREATED_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "COM_ACCT_ID" INT8,
  "LLM_TYPE" VARCHAR(500) COLLATE "PG_CATALOG"."DEFAULT",
  "LANGUAGE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TEMPLATE_CODE" VARCHAR COLLATE "PG_CATALOG"."DEFAULT",
  "TEMPLATE_GROUP" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "TEMPLATE_NAME" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "TEMPLATE_DESC" VARCHAR(2000) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT NULL::CHARACTER VARYING,
  "SUB_TEMPLATE_STATEMENT" TEXT COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."PROMPT_TEMPLATE"."TEMPLATE_GROUP" IS '模板分组';
COMMENT ON COLUMN "KNOWLEDGE"."PROMPT_TEMPLATE"."TEMPLATE_NAME" IS '模板名称';
COMMENT ON COLUMN "KNOWLEDGE"."PROMPT_TEMPLATE"."TEMPLATE_DESC" IS '模板描述';
COMMENT ON COLUMN "KNOWLEDGE"."PROMPT_TEMPLATE"."SUB_TEMPLATE_STATEMENT" IS '子模板';

-- ----------------------------
-- TABLE STRUCTURE FOR RECENTLY_USED_APPS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."RECENTLY_USED_APPS";
CREATE TABLE "KNOWLEDGE"."RECENTLY_USED_APPS" (
  "ID" INT8 NOT NULL,
  "USER_ID" INT8 NOT NULL,
  "APP_ID" INT8 NOT NULL,
  "CREATE_TIME" TIMESTAMP(6) NOT NULL,
  "UPDATE_TIME" TIMESTAMP(6) NOT NULL
)
;
COMMENT ON COLUMN "KNOWLEDGE"."RECENTLY_USED_APPS"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."RECENTLY_USED_APPS"."USER_ID" IS '用户ID';
COMMENT ON COLUMN "KNOWLEDGE"."RECENTLY_USED_APPS"."APP_ID" IS '智能体ID';
COMMENT ON COLUMN "KNOWLEDGE"."RECENTLY_USED_APPS"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."RECENTLY_USED_APPS"."UPDATE_TIME" IS '修改时间';
COMMENT ON TABLE "KNOWLEDGE"."RECENTLY_USED_APPS" IS '用户最近使用智能体，只保留最近3个使用记录';

-- ----------------------------
-- TABLE STRUCTURE FOR REL_PLATFORM
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."REL_PLATFORM";
CREATE TABLE "KNOWLEDGE"."REL_PLATFORM" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "PLATFORM_ID" INT8,
  "EXT_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "EXT_TYPE" INT4 DEFAULT 0,
  "OPEN_RELEASE_STATUS" INT4 DEFAULT 0,
  "VISIBLE_STATUS" INT4 DEFAULT 0,
  "EXT_ID_BEFORE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6) DEFAULT NOW(),
  "CREATE_USER" INT8,
  "TEMPLATE_TYPE" INT4
)
;
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLATFORM"."ID" IS '主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLATFORM"."PLATFORM_ID" IS '平台信息ID';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLATFORM"."EXT_ID" IS 'RELEASE 发布表的主键： 智能体/插件/知识库工具ID';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLATFORM"."EXT_TYPE" IS '智能体 ：1 ；插件：2  ；知识库 ：3 ；工具：4   工作流：5';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLATFORM"."OPEN_RELEASE_STATUS" IS '开放应用发布状态 0: 未开放 1：已开放';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLATFORM"."VISIBLE_STATUS" IS '可见性状态 0：私有访问  1：公共访问  2:平台团队访问';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLATFORM"."EXT_ID_BEFORE" IS '未发布的表主键ID ， 智能体/插件/知识库工具ID';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLATFORM"."CREATE_USER" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLATFORM"."TEMPLATE_TYPE" IS '模板类型';
COMMENT ON TABLE "KNOWLEDGE"."REL_PLATFORM" IS '发布平台关联表';

-- ----------------------------
-- TABLE STRUCTURE FOR REL_PLATFORM_COPY
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."REL_PLATFORM_COPY";
CREATE TABLE "KNOWLEDGE"."REL_PLATFORM_COPY" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "PLATFORM_ID" INT8,
  "EXT_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "EXT_TYPE" INT4 DEFAULT 0,
  "OPEN_RELEASE_STATUS" INT4 DEFAULT 0,
  "VISIBLE_STATUS" INT4 DEFAULT 0,
  "EXT_ID_BEFORE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6) DEFAULT NOW(),
  "CREATE_USER" INT8,
  "TEMPLATE_TYPE" INT4
)
;
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLATFORM_COPY"."ID" IS '主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLATFORM_COPY"."PLATFORM_ID" IS '平台信息ID';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLATFORM_COPY"."EXT_ID" IS '智能体/插件/知识库工具ID';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLATFORM_COPY"."EXT_TYPE" IS '智能体 ：1 ；插件：2  ；知识库 ：3 ；工具：4   工作流：5';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLATFORM_COPY"."OPEN_RELEASE_STATUS" IS '开放应用发布状态 0: 未开放 1：已开放';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLATFORM_COPY"."VISIBLE_STATUS" IS '可见性状态 0：私有访问  1：公共访问  2:平台团队访问';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLATFORM_COPY"."EXT_ID_BEFORE" IS '未发布的表主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLATFORM_COPY"."CREATE_USER" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLATFORM_COPY"."TEMPLATE_TYPE" IS '模板类型';
COMMENT ON TABLE "KNOWLEDGE"."REL_PLATFORM_COPY" IS '发布平台关联表';

-- ----------------------------
-- TABLE STRUCTURE FOR REL_PLUGIN_APP
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."REL_PLUGIN_APP";
CREATE TABLE "KNOWLEDGE"."REL_PLUGIN_APP" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "REL_APP_ID" INT8,
  "PLUGIN_APP_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_MACHINE_ID" VARCHAR(256) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATETIME" TIMESTAMP(6),
  "TEAMID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "TYPE" INT4,
  "IS_DEFAULT" INT4,
  "RETRIEVAL_INFO" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "VERSION_RELEASE" INT4 DEFAULT 1,
  "MCP_ID" VARCHAR(256) COLLATE "PG_CATALOG"."DEFAULT",
  "REL_FROM_TYPE" INT4
)
;
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP"."REL_APP_ID" IS '关联智能体主键';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP"."PLUGIN_APP_ID" IS '关联工作流/插件主键';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP"."PLUGIN_MACHINE_ID" IS '关联工具主键，TYPE=2时 存知识库主键';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP"."CREATETIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP"."TEAMID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP"."TYPE" IS '类型 0:插件 1:工作流 2:知识库';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP"."IS_DEFAULT" IS '是否默认';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP"."RETRIEVAL_INFO" IS '控制返回指标 JSON串';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP"."VERSION_RELEASE" IS '版本号';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP"."MCP_ID" IS '关联MCP_ID';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP"."REL_FROM_TYPE" IS '关联插件的来源：1 ：个人空间  2：团队空间  3：广场';

-- ----------------------------
-- TABLE STRUCTURE FOR REL_PLUGIN_APP_RELEASE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."REL_PLUGIN_APP_RELEASE";
CREATE TABLE "KNOWLEDGE"."REL_PLUGIN_APP_RELEASE" (
  "ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "REL_APP_ID" INT8,
  "PLUGIN_APP_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "PLUGIN_MACHINE_ID" VARCHAR(256) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATETIME" TIMESTAMP(6),
  "TEAMID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "TYPE" INT4,
  "IS_DEFAULT" INT4,
  "RETRIEVAL_INFO" VARCHAR(512) COLLATE "PG_CATALOG"."DEFAULT",
  "VERSION_RELEASE" INT4 DEFAULT 1,
  "MCP_ID" VARCHAR(256) COLLATE "PG_CATALOG"."DEFAULT",
  "REL_FROM_TYPE" INT4
)
;
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP_RELEASE"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP_RELEASE"."REL_APP_ID" IS '关联智能体主键';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP_RELEASE"."PLUGIN_APP_ID" IS '关联工作流/插件主键';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP_RELEASE"."PLUGIN_MACHINE_ID" IS '关联工具主键，TYPE=2时 存知识库主键';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP_RELEASE"."CREATETIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP_RELEASE"."TEAMID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP_RELEASE"."TYPE" IS '类型 0:插件 1:工作流 2:知识库';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP_RELEASE"."IS_DEFAULT" IS '是否默认';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP_RELEASE"."RETRIEVAL_INFO" IS '控制返回指标 JSON串';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP_RELEASE"."VERSION_RELEASE" IS '版本号';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP_RELEASE"."MCP_ID" IS '关联MCP_ID';
COMMENT ON COLUMN "KNOWLEDGE"."REL_PLUGIN_APP_RELEASE"."REL_FROM_TYPE" IS '关联插件的来源：1 ：个人空间  2：团队空间  3：广场';

-- ----------------------------
-- TABLE STRUCTURE FOR SEQUENCE
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."SEQUENCE";
CREATE TABLE "KNOWLEDGE"."SEQUENCE" (
  "SEQUENCE_ID" INT8 NOT NULL,
  "SEQUENCE_NAME" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "CURRENT_VALUE" INT8,
  "INCREMENT_BY" INT4,
  "SEQ_COMMENT" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."SEQUENCE"."SEQUENCE_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."SEQUENCE"."SEQUENCE_NAME" IS '序列编码';
COMMENT ON COLUMN "KNOWLEDGE"."SEQUENCE"."CURRENT_VALUE" IS '当前值';
COMMENT ON COLUMN "KNOWLEDGE"."SEQUENCE"."INCREMENT_BY" IS '步长';
COMMENT ON COLUMN "KNOWLEDGE"."SEQUENCE"."SEQ_COMMENT" IS '描述';

-- ----------------------------
-- TABLE STRUCTURE FOR SMART_LABEL
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."SMART_LABEL";
CREATE TABLE "KNOWLEDGE"."SMART_LABEL" (
  "CODE" INT8,
  "NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TYPE" INT2,
  "SORT" INT2,
  "SMART_LABEL_ID" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "STATUS" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT" DEFAULT 1,
  "CREATED_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "CREATED_ID" INT8,
  "UPDATE_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."SMART_LABEL"."CODE" IS '标签CODE';
COMMENT ON COLUMN "KNOWLEDGE"."SMART_LABEL"."NAME" IS '标签名字
';
COMMENT ON COLUMN "KNOWLEDGE"."SMART_LABEL"."TYPE" IS '标签类型
1-智能体
2-插件
3-知识库
4-工作流
8-MCP
9-数据库';
COMMENT ON COLUMN "KNOWLEDGE"."SMART_LABEL"."SORT" IS '排序 值越小 排序靠前';
COMMENT ON COLUMN "KNOWLEDGE"."SMART_LABEL"."SMART_LABEL_ID" IS '业务域分类ID';
COMMENT ON COLUMN "KNOWLEDGE"."SMART_LABEL"."STATUS" IS '启用状态(1:启用,2：禁用)';
COMMENT ON COLUMN "KNOWLEDGE"."SMART_LABEL"."CREATED_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."SMART_LABEL"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."SMART_LABEL"."CREATED_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."SMART_LABEL"."UPDATE_ID" IS '更新人';

-- ----------------------------
-- TABLE STRUCTURE FOR SMART_LABEL_1
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."SMART_LABEL_1";
CREATE TABLE "KNOWLEDGE"."SMART_LABEL_1" (
  "CODE" INT2,
  "NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TYPE" INT2,
  "SORT" INT2,
  "SMART_LABEL_ID" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "STATUS" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATED_TIME" TIMESTAMP(6),
  "UPDATE_TIME" TIMESTAMP(6),
  "CREATED_ID" INT8,
  "UPDATE_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."SMART_LABEL_1"."CODE" IS '标签CODE';
COMMENT ON COLUMN "KNOWLEDGE"."SMART_LABEL_1"."NAME" IS '标签名字
';
COMMENT ON COLUMN "KNOWLEDGE"."SMART_LABEL_1"."TYPE" IS '标签类型
1-智能体
2-插件
3-知识库
4-工作流
8-MCP
9-数据库';
COMMENT ON COLUMN "KNOWLEDGE"."SMART_LABEL_1"."SORT" IS '排序 值越小 排序靠前';
COMMENT ON COLUMN "KNOWLEDGE"."SMART_LABEL_1"."SMART_LABEL_ID" IS '业务域分类ID';
COMMENT ON COLUMN "KNOWLEDGE"."SMART_LABEL_1"."STATUS" IS '启用状态(1:启用,2：禁用)';
COMMENT ON COLUMN "KNOWLEDGE"."SMART_LABEL_1"."CREATED_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."SMART_LABEL_1"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."SMART_LABEL_1"."CREATED_ID" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."SMART_LABEL_1"."UPDATE_ID" IS '更新人';

-- ----------------------------
-- TABLE STRUCTURE FOR STAT_API_DAY
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."STAT_API_DAY";
CREATE TABLE "KNOWLEDGE"."STAT_API_DAY" (
  "ID" INT8 NOT NULL,
  "APP_ID" INT8 NOT NULL,
  "DAY" TIMESTAMP(6) NOT NULL,
  "CHAT_COUNT" INT4 NOT NULL,
  "INPUT_TOKEN" INT8 NOT NULL,
  "OUTPUT_TOKEN" INT8 NOT NULL DEFAULT 0,
  "TOTAL_TOKEN" INT8 NOT NULL,
  "AVG_RESP_COST" INT4 NOT NULL
)
;
COMMENT ON COLUMN "KNOWLEDGE"."STAT_API_DAY"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_API_DAY"."APP_ID" IS '智能体ID';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_API_DAY"."DAY" IS '统计时间（天）';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_API_DAY"."CHAT_COUNT" IS '对话数';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_API_DAY"."INPUT_TOKEN" IS '输入TOKEN';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_API_DAY"."OUTPUT_TOKEN" IS '输出TOKEN';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_API_DAY"."TOTAL_TOKEN" IS '总TOKEN';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_API_DAY"."AVG_RESP_COST" IS '平均响应时间（MS）';
COMMENT ON TABLE "KNOWLEDGE"."STAT_API_DAY" IS '会话统计';

-- ----------------------------
-- TABLE STRUCTURE FOR STAT_API_DAY_20250915
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."STAT_API_DAY_20250915";
CREATE TABLE "KNOWLEDGE"."STAT_API_DAY_20250915" (
  "ID" INT8 NOT NULL,
  "APP_ID" INT8 NOT NULL,
  "DAY" TIMESTAMP(6) NOT NULL,
  "CHAT_COUNT" INT4 NOT NULL,
  "INPUT_TOKEN" INT8 NOT NULL,
  "OUTPUT_TOKEN" INT8 NOT NULL,
  "TOTAL_TOKEN" INT8 NOT NULL,
  "AVG_RESP_COST" INT4 NOT NULL
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR STAT_CHAT_DAY
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."STAT_CHAT_DAY";
CREATE TABLE "KNOWLEDGE"."STAT_CHAT_DAY" (
  "ID" INT8 NOT NULL,
  "APP_ID" INT8 NOT NULL,
  "DAY" TIMESTAMP(6) NOT NULL,
  "SESSION_COUNT" INT4 NOT NULL,
  "CHAT_COUNT" INT4 NOT NULL,
  "INPUT_TOKEN" INT8 NOT NULL,
  "OUTPUT_TOKEN" INT8 NOT NULL DEFAULT 0,
  "TOTAL_TOKEN" INT8 NOT NULL,
  "FEEDBACK_GOOD_COUNT" INT4 NOT NULL,
  "FEEDBACK_BAD_COUNT" INT4 NOT NULL,
  "AVG_RESP_COST" INT4 NOT NULL,
  "PLATFORM_TYPE" INT4 NOT NULL,
  "USERS" TEXT COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."STAT_CHAT_DAY"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_CHAT_DAY"."APP_ID" IS '显示名称';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_CHAT_DAY"."DAY" IS '统计时间（天）';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_CHAT_DAY"."SESSION_COUNT" IS '会话数';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_CHAT_DAY"."CHAT_COUNT" IS '对话数';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_CHAT_DAY"."INPUT_TOKEN" IS '输入TOKEN';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_CHAT_DAY"."OUTPUT_TOKEN" IS '输出TOKEN';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_CHAT_DAY"."TOTAL_TOKEN" IS '总TOKEN';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_CHAT_DAY"."FEEDBACK_GOOD_COUNT" IS '点赞数';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_CHAT_DAY"."FEEDBACK_BAD_COUNT" IS '点踩数';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_CHAT_DAY"."AVG_RESP_COST" IS '平均响应时间（MS）';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_CHAT_DAY"."PLATFORM_TYPE" IS '0-合计 1-大瓦特APP 2-智能体平台 ';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_CHAT_DAY"."USERS" IS '用户 ，分割';
COMMENT ON TABLE "KNOWLEDGE"."STAT_CHAT_DAY" IS '会话统计';

-- ----------------------------
-- TABLE STRUCTURE FOR STAT_TOKEN
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."STAT_TOKEN";
CREATE TABLE "KNOWLEDGE"."STAT_TOKEN" (
  "ID" INT8 NOT NULL,
  "APP_ID" INT8 NOT NULL,
  "DAY" TIMESTAMP(6) NOT NULL,
  "INPUT_TOKEN" INT8 NOT NULL,
  "OUTPUT_TOKEN" INT8 NOT NULL DEFAULT 0,
  "TOTAL_TOKEN" INT8 NOT NULL,
  "PLATFORM_TYPE" INT4 NOT NULL,
  "MODEL_ID" INT8 NOT NULL,
  "MODEL_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "MODEL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."STAT_TOKEN"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_TOKEN"."APP_ID" IS '显示名称';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_TOKEN"."DAY" IS '统计时间（天）';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_TOKEN"."INPUT_TOKEN" IS '输入TOKEN';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_TOKEN"."OUTPUT_TOKEN" IS '输出TOKEN';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_TOKEN"."TOTAL_TOKEN" IS '总TOKEN';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_TOKEN"."PLATFORM_TYPE" IS '1-大瓦特APP 2-智能体平台 3-API';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_TOKEN"."MODEL_ID" IS '模型ID';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_TOKEN"."MODEL_NAME" IS '模型中文名';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_TOKEN"."MODEL" IS '模型';
COMMENT ON TABLE "KNOWLEDGE"."STAT_TOKEN" IS '会话统计';

-- ----------------------------
-- TABLE STRUCTURE FOR STAT_TOKEN_20250915
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."STAT_TOKEN_20250915";
CREATE TABLE "KNOWLEDGE"."STAT_TOKEN_20250915" (
  "ID" INT8 NOT NULL,
  "APP_ID" INT8 NOT NULL,
  "DAY" TIMESTAMP(6) NOT NULL,
  "INPUT_TOKEN" INT8 NOT NULL,
  "OUTPUT_TOKEN" INT8 NOT NULL,
  "TOTAL_TOKEN" INT8 NOT NULL,
  "PLATFORM_TYPE" INT4 NOT NULL,
  "MODEL_ID" INT8 NOT NULL,
  "MODEL_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "MODEL" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT"
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR STAT_USER
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."STAT_USER";
CREATE TABLE "KNOWLEDGE"."STAT_USER" (
  "ID" INT8 NOT NULL,
  "APP_ID" INT8 NOT NULL,
  "DAY" TIMESTAMP(6) NOT NULL,
  "PLATFORM_TYPE" INT4 NOT NULL,
  "USER_ID" INT8 NOT NULL,
  "CHAT_NUM" INT4 NOT NULL
)
;
COMMENT ON COLUMN "KNOWLEDGE"."STAT_USER"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_USER"."APP_ID" IS '显示名称';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_USER"."DAY" IS '统计时间（天）';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_USER"."PLATFORM_TYPE" IS '1-大瓦特APP 2-智能体平台 3-API';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_USER"."USER_ID" IS '用户ID';
COMMENT ON COLUMN "KNOWLEDGE"."STAT_USER"."CHAT_NUM" IS '对话数量';
COMMENT ON TABLE "KNOWLEDGE"."STAT_USER" IS '会话统计';

-- ----------------------------
-- TABLE STRUCTURE FOR SYNONYMS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."SYNONYMS";
CREATE TABLE "KNOWLEDGE"."SYNONYMS" (
  "SYNONYM_ID" INT8 NOT NULL,
  "SYNONYM_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "SYNONYM_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_BY" INT8,
  "CREATED_TIME" TIMESTAMP(6),
  "UPDATE_BY" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "COM_ACCT_ID" INT8,
  "DATASET_ID" INT8,
  "GRAPH_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."SYNONYMS"."SYNONYM_ID" IS '同义词标识';
COMMENT ON COLUMN "KNOWLEDGE"."SYNONYMS"."SYNONYM_NAME" IS '同义词名称';
COMMENT ON COLUMN "KNOWLEDGE"."SYNONYMS"."SYNONYM_CODE" IS '同义词编码';
COMMENT ON COLUMN "KNOWLEDGE"."SYNONYMS"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."SYNONYMS"."CREATED_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."SYNONYMS"."UPDATE_BY" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."SYNONYMS"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."SYNONYMS"."COM_ACCT_ID" IS '所属企业';
COMMENT ON TABLE "KNOWLEDGE"."SYNONYMS" IS '同义词表';

-- ----------------------------
-- TABLE STRUCTURE FOR SYSTEM_OPEN_MAN
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."SYSTEM_OPEN_MAN";
CREATE TABLE "KNOWLEDGE"."SYSTEM_OPEN_MAN" (
  "SYSTEM_ID" INT8,
  "SYSTEM_SECRET" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "SYSTEM_KEY" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "IP_WHITELIST" VARCHAR(1024) COLLATE "PG_CATALOG"."DEFAULT",
  "IP_BLACKLIST" VARCHAR(1024) COLLATE "PG_CATALOG"."DEFAULT",
  "MAXIMUM_ACCESS_TIMES" INT4,
  "MAXIMUM_ACCESS_FREQUENCY" INT4,
  "CREATE_TIME" TIMESTAMP(6),
  "CREATE_BY" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "UPDATE_BY" INT8,
  "STATE" VARCHAR(3) COLLATE "PG_CATALOG"."DEFAULT",
  "SYSTEM_NAME" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."SYSTEM_OPEN_MAN"."SYSTEM_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."SYSTEM_OPEN_MAN"."SYSTEM_SECRET" IS '系统密钥';
COMMENT ON COLUMN "KNOWLEDGE"."SYSTEM_OPEN_MAN"."SYSTEM_KEY" IS '系统KEY';
COMMENT ON COLUMN "KNOWLEDGE"."SYSTEM_OPEN_MAN"."IP_WHITELIST" IS 'IP白名单';
COMMENT ON COLUMN "KNOWLEDGE"."SYSTEM_OPEN_MAN"."IP_BLACKLIST" IS 'IP黑名单';
COMMENT ON COLUMN "KNOWLEDGE"."SYSTEM_OPEN_MAN"."MAXIMUM_ACCESS_TIMES" IS '每天最大访问次数';
COMMENT ON COLUMN "KNOWLEDGE"."SYSTEM_OPEN_MAN"."MAXIMUM_ACCESS_FREQUENCY" IS '单位时间最大访问频率';
COMMENT ON COLUMN "KNOWLEDGE"."SYSTEM_OPEN_MAN"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."SYSTEM_OPEN_MAN"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."SYSTEM_OPEN_MAN"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."SYSTEM_OPEN_MAN"."UPDATE_BY" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."SYSTEM_OPEN_MAN"."STATE" IS '是否启用';
COMMENT ON COLUMN "KNOWLEDGE"."SYSTEM_OPEN_MAN"."SYSTEM_NAME" IS '系统名称';
COMMENT ON TABLE "KNOWLEDGE"."SYSTEM_OPEN_MAN" IS '外部系统访问管理';

-- ----------------------------
-- TABLE STRUCTURE FOR TB_GLOSSARY
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."TB_GLOSSARY";
CREATE TABLE "KNOWLEDGE"."TB_GLOSSARY" (
  "GLOSSARY_ID" INT8 NOT NULL,
  "GLOSSARY_NAME" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "GLOSSARY_TYPE" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "SUB_TYPE" VARCHAR(4) COLLATE "PG_CATALOG"."DEFAULT",
  "P_GLOSSARY_ID" INT8,
  "DATASET_ID" INT8,
  "REL_TABLE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "REL_PK_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" INT8,
  "CREATE_USER" INT8,
  "FILE_ID" INT8,
  "TERM_TYPE_ID" INT8,
  "TERM_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."TB_GLOSSARY"."GLOSSARY_ID" IS '术语ID';
COMMENT ON COLUMN "KNOWLEDGE"."TB_GLOSSARY"."GLOSSARY_NAME" IS '术语名称';
COMMENT ON COLUMN "KNOWLEDGE"."TB_GLOSSARY"."GLOSSARY_TYPE" IS '类型:1：概念、2：实体';
COMMENT ON COLUMN "KNOWLEDGE"."TB_GLOSSARY"."SUB_TYPE" IS '子类型：1：文档，2：表格，3：工具, 4:参数';
COMMENT ON COLUMN "KNOWLEDGE"."TB_GLOSSARY"."P_GLOSSARY_ID" IS '所属术语（同义词）';
COMMENT ON COLUMN "KNOWLEDGE"."TB_GLOSSARY"."DATASET_ID" IS '所属知识库';
COMMENT ON COLUMN "KNOWLEDGE"."TB_GLOSSARY"."REL_TABLE" IS '关联表(TERM_TYPES、TERMS、DATASET_DATA_TABLE、DATASET_DATA_TABLE_KPI、DATASET_DATA_TABLE_REF_TERM)';
COMMENT ON COLUMN "KNOWLEDGE"."TB_GLOSSARY"."REL_PK_ID" IS '关联外键';
COMMENT ON COLUMN "KNOWLEDGE"."TB_GLOSSARY"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."TB_GLOSSARY"."TEAM_ID" IS '所属团队';
COMMENT ON COLUMN "KNOWLEDGE"."TB_GLOSSARY"."CREATE_USER" IS '创建人ID';
COMMENT ON COLUMN "KNOWLEDGE"."TB_GLOSSARY"."FILE_ID" IS '所属文件';
COMMENT ON TABLE "KNOWLEDGE"."TB_GLOSSARY" IS '术语词汇表';

-- ----------------------------
-- TABLE STRUCTURE FOR TEAM_MEMBERS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."TEAM_MEMBERS";
CREATE TABLE "KNOWLEDGE"."TEAM_MEMBERS" (
  "ID" INT8 NOT NULL,
  "USER_ID" INT8 NOT NULL,
  "TEAM_ID" INT8 NOT NULL,
  "DEFAULT_TEAM" BOOL,
  "NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ROLE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "STATUS" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6)
)
;
COMMENT ON COLUMN "KNOWLEDGE"."TEAM_MEMBERS"."ID" IS '主键标识';
COMMENT ON COLUMN "KNOWLEDGE"."TEAM_MEMBERS"."USER_ID" IS '用户ID';
COMMENT ON COLUMN "KNOWLEDGE"."TEAM_MEMBERS"."TEAM_ID" IS '团队ID';
COMMENT ON COLUMN "KNOWLEDGE"."TEAM_MEMBERS"."DEFAULT_TEAM" IS '是否默认团队';
COMMENT ON COLUMN "KNOWLEDGE"."TEAM_MEMBERS"."NAME" IS '名称';
COMMENT ON COLUMN "KNOWLEDGE"."TEAM_MEMBERS"."ROLE" IS '角色';
COMMENT ON COLUMN "KNOWLEDGE"."TEAM_MEMBERS"."STATUS" IS '状态：ACTIVE INACTIVE';
COMMENT ON COLUMN "KNOWLEDGE"."TEAM_MEMBERS"."CREATE_TIME" IS '创建时间';
COMMENT ON TABLE "KNOWLEDGE"."TEAM_MEMBERS" IS '团队成员表';

-- ----------------------------
-- TABLE STRUCTURE FOR TEAM_MEMBERS_0710
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."TEAM_MEMBERS_0710";
CREATE TABLE "KNOWLEDGE"."TEAM_MEMBERS_0710" (
  "ID" INT8,
  "USER_ID" INT8,
  "TEAM_ID" INT8,
  "DEFAULT_TEAM" BOOL,
  "NAME" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ROLE" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "STATUS" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_TIME" TIMESTAMP(6)
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR TEAMS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."TEAMS";
CREATE TABLE "KNOWLEDGE"."TEAMS" (
  "ID" INT8 NOT NULL,
  "NAME" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "TEAM_CODE" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "AVATAR" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "MAX_SIZE" INT4,
  "TITLE" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "INTRO" VARCHAR(2000) COLLATE "PG_CATALOG"."DEFAULT",
  "OWNER_ID" VARCHAR(200) COLLATE "PG_CATALOG"."DEFAULT",
  "PARENT_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "V" INT4,
  "PLATFORM_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON COLUMN "KNOWLEDGE"."TEAMS"."ID" IS '团队ID';
COMMENT ON COLUMN "KNOWLEDGE"."TEAMS"."NAME" IS '团队名称';
COMMENT ON COLUMN "KNOWLEDGE"."TEAMS"."TEAM_CODE" IS '团队编码';
COMMENT ON COLUMN "KNOWLEDGE"."TEAMS"."AVATAR" IS '团队头像';
COMMENT ON COLUMN "KNOWLEDGE"."TEAMS"."MAX_SIZE" IS '团队最大成员数量';
COMMENT ON COLUMN "KNOWLEDGE"."TEAMS"."TITLE" IS '标题';
COMMENT ON COLUMN "KNOWLEDGE"."TEAMS"."INTRO" IS '团队简介';
COMMENT ON COLUMN "KNOWLEDGE"."TEAMS"."OWNER_ID" IS '团队负责人';
COMMENT ON COLUMN "KNOWLEDGE"."TEAMS"."PARENT_ID" IS '父级团队';
COMMENT ON COLUMN "KNOWLEDGE"."TEAMS"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."TEAMS"."PLATFORM_ID" IS '平台ID 字符串';
COMMENT ON TABLE "KNOWLEDGE"."TEAMS" IS '团队信息表';

-- ----------------------------
-- TABLE STRUCTURE FOR TEMP_VECTOR
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."TEMP_VECTOR";
CREATE TABLE "KNOWLEDGE"."TEMP_VECTOR" (
  "DOMAIN" VARCHAR(256) COLLATE "PG_CATALOG"."DEFAULT"
)
;
COMMENT ON TABLE "KNOWLEDGE"."TEMP_VECTOR" IS '测试用_向量数据库';

-- ----------------------------
-- TABLE STRUCTURE FOR TEMP_VECTOR_DATA
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."TEMP_VECTOR_DATA";
CREATE TABLE "KNOWLEDGE"."TEMP_VECTOR_DATA" (
  "DOMAIN" VARCHAR(256) COLLATE "PG_CATALOG"."DEFAULT",
  "DOCUMENT" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "FILE_NAME" VARCHAR(256) COLLATE "PG_CATALOG"."DEFAULT"
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR TERM_CATALOGS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."TERM_CATALOGS";
CREATE TABLE "KNOWLEDGE"."TERM_CATALOGS" (
  "TERM_CATALOG_ID" INT8 NOT NULL,
  "TERM_CATALOG_NAME" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "PARENT_ID" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "TEAM_ID" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "DATASET_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."TERM_CATALOGS"."TERM_CATALOG_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_CATALOGS"."TERM_CATALOG_NAME" IS '目录名称';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_CATALOGS"."PARENT_ID" IS '父目录';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_CATALOGS"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_CATALOGS"."TEAM_ID" IS '归属团队';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_CATALOGS"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_CATALOGS"."DATASET_ID" IS '所属知识库';
COMMENT ON TABLE "KNOWLEDGE"."TERM_CATALOGS" IS '实体目录表';

-- ----------------------------
-- TABLE STRUCTURE FOR TERM_IMPORT
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."TERM_IMPORT";
CREATE TABLE "KNOWLEDGE"."TERM_IMPORT" (
  "TERM_ID" INT8 NOT NULL,
  "TERM_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TERM_CODE" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "DATASET_ID" INT8,
  "CREATE_BY" INT8,
  "CREATED_TIME" TIMESTAMP(6),
  "UPDATE_BY" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "COM_ACCT_ID" INT8,
  "IMPORT_BATCH_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."TERM_IMPORT"."TERM_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_IMPORT"."TERM_NAME" IS '实体名称';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_IMPORT"."TERM_CODE" IS '实体编码';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_IMPORT"."DATASET_ID" IS '所属知识库';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_IMPORT"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_IMPORT"."CREATED_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_IMPORT"."UPDATE_BY" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_IMPORT"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_IMPORT"."COM_ACCT_ID" IS '所属企业';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_IMPORT"."IMPORT_BATCH_ID" IS '导入批清单标识';

-- ----------------------------
-- TABLE STRUCTURE FOR TERM_SYNONYM_REF
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."TERM_SYNONYM_REF";
CREATE TABLE "KNOWLEDGE"."TERM_SYNONYM_REF" (
  "TERM_ID" INT8 NOT NULL,
  "SYNONYM_ID" INT8 NOT NULL
)
;
COMMENT ON COLUMN "KNOWLEDGE"."TERM_SYNONYM_REF"."TERM_ID" IS '实体标识';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_SYNONYM_REF"."SYNONYM_ID" IS '同义词标识';
COMMENT ON TABLE "KNOWLEDGE"."TERM_SYNONYM_REF" IS '实体关联关系表';

-- ----------------------------
-- TABLE STRUCTURE FOR TERM_SYNONYM_REF_IMPORT
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."TERM_SYNONYM_REF_IMPORT";
CREATE TABLE "KNOWLEDGE"."TERM_SYNONYM_REF_IMPORT" (
  "TERM_ID" INT8,
  "SYNONYM_ID" INT8,
  "IMPORT_BATCH_ID" INT8,
  "TERM_SYNONYM_ID" INT8 NOT NULL
)
;
COMMENT ON COLUMN "KNOWLEDGE"."TERM_SYNONYM_REF_IMPORT"."TERM_ID" IS '实体标识';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_SYNONYM_REF_IMPORT"."SYNONYM_ID" IS '同义词标识';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_SYNONYM_REF_IMPORT"."IMPORT_BATCH_ID" IS '批处理标识';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_SYNONYM_REF_IMPORT"."TERM_SYNONYM_ID" IS '主键标识';
COMMENT ON TABLE "KNOWLEDGE"."TERM_SYNONYM_REF_IMPORT" IS '同义词导入记录表';

-- ----------------------------
-- TABLE STRUCTURE FOR TERM_TYPES
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."TERM_TYPES";
CREATE TABLE "KNOWLEDGE"."TERM_TYPES" (
  "TERM_TYPE_ID" INT8 NOT NULL,
  "TERM_TYPE_CODE" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "TERM_TYPE_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "TERM_TYPE" INT4,
  "CREATE_BY" INT8,
  "CREATED_TIME" TIMESTAMP(6),
  "UPDATE_BY" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "COM_ACCT_ID" INT8,
  "DATASET_ID" INT8,
  "TERM_SOURCE" INT4,
  "PARENT_ID" INT8,
  "FILE_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."TERM_TYPES"."TERM_TYPE_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_TYPES"."TERM_TYPE_CODE" IS '概念编码';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_TYPES"."TERM_TYPE_NAME" IS '概念名称';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_TYPES"."TERM_TYPE" IS '概念类型 1：实体 2：关系 3：事件';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_TYPES"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_TYPES"."CREATED_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_TYPES"."UPDATE_BY" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_TYPES"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_TYPES"."COM_ACCT_ID" IS '所属企业';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_TYPES"."DATASET_ID" IS '所属知识库';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_TYPES"."TERM_SOURCE" IS '来源  1：系统内置  2：自定义';
COMMENT ON COLUMN "KNOWLEDGE"."TERM_TYPES"."PARENT_ID" IS '所属的概念的父级ID（具有父子关系）';
COMMENT ON TABLE "KNOWLEDGE"."TERM_TYPES" IS '概念表';

-- ----------------------------
-- TABLE STRUCTURE FOR TERMS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."TERMS";
CREATE TABLE "KNOWLEDGE"."TERMS" (
  "TERM_ID" INT8 NOT NULL,
  "TERM_NAME" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "TERM_CODE" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "CREATE_BY" INT8,
  "CREATED_TIME" TIMESTAMP(6),
  "UPDATE_BY" INT8,
  "UPDATE_TIME" TIMESTAMP(6),
  "COM_ACCT_ID" INT8,
  "DATASET_ID" INT8,
  "TERM_TYPE_ID" INT8,
  "GRAPH_ID" INT8,
  "REL_DATASOURCE_CODE" INT8,
  "TERM_CATALOG_ID" INT8,
  "FILE_ID" INT8
)
;
COMMENT ON COLUMN "KNOWLEDGE"."TERMS"."TERM_ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."TERMS"."TERM_NAME" IS '实体名称';
COMMENT ON COLUMN "KNOWLEDGE"."TERMS"."TERM_CODE" IS '实体编码';
COMMENT ON COLUMN "KNOWLEDGE"."TERMS"."CREATE_BY" IS '创建人';
COMMENT ON COLUMN "KNOWLEDGE"."TERMS"."CREATED_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."TERMS"."UPDATE_BY" IS '更新人';
COMMENT ON COLUMN "KNOWLEDGE"."TERMS"."UPDATE_TIME" IS '更新时间';
COMMENT ON COLUMN "KNOWLEDGE"."TERMS"."COM_ACCT_ID" IS '所属企业';
COMMENT ON COLUMN "KNOWLEDGE"."TERMS"."DATASET_ID" IS '所属知识库';
COMMENT ON COLUMN "KNOWLEDGE"."TERMS"."TERM_TYPE_ID" IS '所属概念';
COMMENT ON COLUMN "KNOWLEDGE"."TERMS"."TERM_CATALOG_ID" IS '所属实体目录';
COMMENT ON TABLE "KNOWLEDGE"."TERMS" IS '实体表';

-- ----------------------------
-- TABLE STRUCTURE FOR TNGP_USER_REF
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."TNGP_USER_REF";
CREATE TABLE "KNOWLEDGE"."TNGP_USER_REF" (
  "ID" INT8 NOT NULL,
  "USER_ID" INT8 NOT NULL,
  "PARENT_ID" INT8,
  "USER_TYPE" INT8,
  "PROVINCE_ID" INT8,
  "CITY_ID" INT8,
  "COM_ACCT_ID" INT8,
  "ORG_ID" INT8,
  "BELONG_SYSTEM_CODE" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PRIVILEGE_TYPE" VARCHAR(10) COLLATE "PG_CATALOG"."DEFAULT",
  "ORIGIN_USER_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORIGIN_ONE_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "ORIGIN_DEPART_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "IS_ORG_APPLAY" CHAR(1) COLLATE "PG_CATALOG"."DEFAULT",
  "ACCESS_KEY" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT",
  "SECRET_KEY" VARCHAR(128) COLLATE "PG_CATALOG"."DEFAULT"
)
;

-- ----------------------------
-- TABLE STRUCTURE FOR USER_APPS_TOP
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."USER_APPS_TOP";
CREATE TABLE "KNOWLEDGE"."USER_APPS_TOP" (
  "ID" INT8 NOT NULL,
  "USER_ID" INT8 NOT NULL,
  "APP_ID" INT8 NOT NULL,
  "IS_DELETE" INT4 DEFAULT 0,
  "CREATE_USER" INT8,
  "UPDATE_USER" INT8,
  "CREATE_TIME" TIMESTAMP(6) DEFAULT NOW(),
  "UPDATE_TIME" TIMESTAMP(6) DEFAULT NOW()
)
;
COMMENT ON COLUMN "KNOWLEDGE"."USER_APPS_TOP"."ID" IS '主键ID';
COMMENT ON COLUMN "KNOWLEDGE"."USER_APPS_TOP"."USER_ID" IS '用户ID';
COMMENT ON COLUMN "KNOWLEDGE"."USER_APPS_TOP"."APP_ID" IS '智能体ID';
COMMENT ON COLUMN "KNOWLEDGE"."USER_APPS_TOP"."IS_DELETE" IS '是否删除 0：否  1：是';
COMMENT ON COLUMN "KNOWLEDGE"."USER_APPS_TOP"."CREATE_USER" IS '创建用户';
COMMENT ON COLUMN "KNOWLEDGE"."USER_APPS_TOP"."UPDATE_USER" IS '更新用户';
COMMENT ON COLUMN "KNOWLEDGE"."USER_APPS_TOP"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."USER_APPS_TOP"."UPDATE_TIME" IS '更新时间';
COMMENT ON TABLE "KNOWLEDGE"."USER_APPS_TOP" IS '用户智能体置顶状态表';

-- ----------------------------
-- TABLE STRUCTURE FOR USER_CONCURRENCY_CONFIG
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."USER_CONCURRENCY_CONFIG";
CREATE TABLE "KNOWLEDGE"."USER_CONCURRENCY_CONFIG" (
  "ID" INT8 NOT NULL,
  "USER_ID" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "USER_ACCOUNT" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "CONCURRENCY" INT4,
  "STATE" INT4 DEFAULT 1
)
;
COMMENT ON COLUMN "KNOWLEDGE"."USER_CONCURRENCY_CONFIG"."ID" IS '主键';
COMMENT ON COLUMN "KNOWLEDGE"."USER_CONCURRENCY_CONFIG"."USER_ID" IS '用户ID';
COMMENT ON COLUMN "KNOWLEDGE"."USER_CONCURRENCY_CONFIG"."USER_ACCOUNT" IS '用户账户';
COMMENT ON COLUMN "KNOWLEDGE"."USER_CONCURRENCY_CONFIG"."CONCURRENCY" IS '并发数';
COMMENT ON COLUMN "KNOWLEDGE"."USER_CONCURRENCY_CONFIG"."STATE" IS '状态(0;不启动;1启动)';

-- ----------------------------
-- TABLE STRUCTURE FOR USERS
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."USERS";
CREATE TABLE "KNOWLEDGE"."USERS" (
  "ID" INT8 NOT NULL,
  "USERNAME" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "AVATAR" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "BALANCE" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "PASSWORD" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "PROMOTION_RATE" INT4,
  "STATUS" VARCHAR(10) COLLATE "PG_CATALOG"."DEFAULT",
  "TIMEZONE" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "ACCOUNT_EXPIRE_TIME" TIMESTAMP(6),
  "LAST_DATASET_ID" INT8,
  "VER" INT4,
  "USER_PHONE" VARCHAR(60) COLLATE "PG_CATALOG"."DEFAULT",
  "USER_SOURCE" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "WECHAT_ACCOUNT" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PLATFORM_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "USER_ACCOUNT" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_FULL_NAME" TEXT COLLATE "PG_CATALOG"."DEFAULT",
  "LAST_PASSWORD" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "FIRST_LOGIN" INT4 DEFAULT 0
)
;
COMMENT ON COLUMN "KNOWLEDGE"."USERS"."ID" IS '主键标识';
COMMENT ON COLUMN "KNOWLEDGE"."USERS"."USERNAME" IS '用户编码';
COMMENT ON COLUMN "KNOWLEDGE"."USERS"."AVATAR" IS '头像';
COMMENT ON COLUMN "KNOWLEDGE"."USERS"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "KNOWLEDGE"."USERS"."PASSWORD" IS '密码';
COMMENT ON COLUMN "KNOWLEDGE"."USERS"."STATUS" IS '状态：ACTIVE活跃的  INACTIVE不活跃的';
COMMENT ON COLUMN "KNOWLEDGE"."USERS"."TIMEZONE" IS '时区';
COMMENT ON COLUMN "KNOWLEDGE"."USERS"."ACCOUNT_EXPIRE_TIME" IS '账号过期时间';
COMMENT ON COLUMN "KNOWLEDGE"."USERS"."LAST_DATASET_ID" IS '最后使用知识库ID';
COMMENT ON COLUMN "KNOWLEDGE"."USERS"."USER_PHONE" IS '用户移动手机号';
COMMENT ON COLUMN "KNOWLEDGE"."USERS"."USER_SOURCE" IS '用户来源';
COMMENT ON COLUMN "KNOWLEDGE"."USERS"."WECHAT_ACCOUNT" IS '用户微信号';
COMMENT ON COLUMN "KNOWLEDGE"."USERS"."PLATFORM_ID" IS '平台ID-字符串';
COMMENT ON COLUMN "KNOWLEDGE"."USERS"."USER_ACCOUNT" IS '平台账号';
COMMENT ON COLUMN "KNOWLEDGE"."USERS"."ORG_NAME" IS '组织名称';
COMMENT ON COLUMN "KNOWLEDGE"."USERS"."ORG_FULL_NAME" IS '组织全名';
COMMENT ON COLUMN "KNOWLEDGE"."USERS"."LAST_PASSWORD" IS '上次使用的密码(能监局需求，其他忽略)';
COMMENT ON COLUMN "KNOWLEDGE"."USERS"."FIRST_LOGIN" IS '是否已登录修改密码0否1是（能监局需求，其他忽略）';
COMMENT ON TABLE "KNOWLEDGE"."USERS" IS '用户信息表';

-- ----------------------------
-- TABLE STRUCTURE FOR USERS_20250604
-- ----------------------------
DROP TABLE IF EXISTS "KNOWLEDGE"."USERS_20250604";
CREATE TABLE "KNOWLEDGE"."USERS_20250604" (
  "ID" INT8 NOT NULL,
  "USERNAME" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "AVATAR" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "BALANCE" INT8,
  "CREATE_TIME" TIMESTAMP(6),
  "PASSWORD" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT" NOT NULL,
  "PROMOTION_RATE" INT4,
  "STATUS" VARCHAR(10) COLLATE "PG_CATALOG"."DEFAULT",
  "TIMEZONE" VARCHAR(100) COLLATE "PG_CATALOG"."DEFAULT",
  "ACCOUNT_EXPIRE_TIME" TIMESTAMP(6),
  "LAST_DATASET_ID" INT8,
  "VER" INT4,
  "USER_PHONE" VARCHAR(60) COLLATE "PG_CATALOG"."DEFAULT",
  "USER_SOURCE" VARCHAR(32) COLLATE "PG_CATALOG"."DEFAULT",
  "WECHAT_ACCOUNT" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "PLATFORM_ID" VARCHAR(64) COLLATE "PG_CATALOG"."DEFAULT",
  "USER_ACCOUNT" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_NAME" VARCHAR(255) COLLATE "PG_CATALOG"."DEFAULT",
  "ORG_FULL_NAME" TEXT COLLATE "PG_CATALOG"."DEFAULT"
)
;

-- ----------------------------
-- FUNCTION STRUCTURE FOR COUNT_CHAT_ITEMS_IN_TIME_PERIOD
-- ----------------------------
DROP FUNCTION IF EXISTS "KNOWLEDGE"."COUNT_CHAT_ITEMS_IN_TIME_PERIOD"("START_TIME" TIMESTAMP, "END_TIME" TIMESTAMP);
CREATE OR REPLACE FUNCTION "KNOWLEDGE"."COUNT_CHAT_ITEMS_IN_TIME_PERIOD"("START_TIME" TIMESTAMP, "END_TIME" TIMESTAMP)
  RETURNS TABLE("MINUTE_START" TIMESTAMP, "COUNT" INT8) AS $BODY$
BEGIN
    RETURN QUERY
    SELECT
        DATE_TRUNC('MINUTE', CREATE_TIME) AS MINUTE_START,
        COUNT(*) AS COUNT
    FROM
        CHAT_ITEMS
    WHERE
        CREATE_TIME >= START_TIME
        AND CREATE_TIME < END_TIME
    GROUP BY
        DATE_TRUNC('MINUTE', CREATE_TIME)
    UNION ALL
    SELECT
        GENERATE_SERIES.GENERATE_SERIES AS MINUTE_START,
        0 AS COUNT
    FROM
        GENERATE_SERIES(
            START_TIME,
            END_TIME,
            INTERVAL '1 MINUTE'
        ) GENERATE_SERIES
    WHERE
        NOT EXISTS (
            SELECT 1
            FROM
                CHAT_ITEMS
            WHERE
                CREATE_TIME >= GENERATE_SERIES.GENERATE_SERIES
                AND CREATE_TIME < GENERATE_SERIES.GENERATE_SERIES + INTERVAL '1 MINUTE'
        );
END; $BODY$
  LANGUAGE PLPGSQL VOLATILE
  COST 100
  ROWS 1000;

-- ----------------------------
-- FUNCTION STRUCTURE FOR COUNT_OPEN_CALL_CHAT
-- ----------------------------
DROP FUNCTION IF EXISTS "KNOWLEDGE"."COUNT_OPEN_CALL_CHAT"("START_TIME_PM" TIMESTAMP, "END_TIME_PM" TIMESTAMP);
CREATE OR REPLACE FUNCTION "KNOWLEDGE"."COUNT_OPEN_CALL_CHAT"("START_TIME_PM" TIMESTAMP, "END_TIME_PM" TIMESTAMP)
  RETURNS TABLE("MINUTE_START" TIMESTAMP, "COUNT" INT8) AS $BODY$
BEGIN
    RETURN QUERY
    SELECT
        DATE_TRUNC('MINUTE', START_TIME) AS MINUTE_START,
        COUNT(*) AS COUNT
    FROM
        OPEN_CALL_STATISTICS
    WHERE
        START_TIME >= START_TIME_PM
        AND START_TIME < END_TIME_PM
				AND   CALL_TYPE = 1
    GROUP BY
        DATE_TRUNC('MINUTE', START_TIME)
    UNION ALL
    SELECT
        GENERATE_SERIES.GENERATE_SERIES AS MINUTE_START,
        0 AS COUNT
    FROM
        GENERATE_SERIES(
            START_TIME_PM,
            END_TIME_PM,
            INTERVAL '1 MINUTE'
        ) GENERATE_SERIES
    WHERE
        NOT EXISTS (
            SELECT 1
            FROM
                OPEN_CALL_STATISTICS
            WHERE
                START_TIME >= GENERATE_SERIES.GENERATE_SERIES
                AND START_TIME < GENERATE_SERIES.GENERATE_SERIES + INTERVAL '1 MINUTE'
								AND   CALL_TYPE = 1
        );
END; $BODY$
  LANGUAGE PLPGSQL VOLATILE
  COST 100
  ROWS 1000;

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE AGENT_DATASETS_OPERATION_LOG
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."AGENT_DATASETS_OPERATION_LOG" ADD CONSTRAINT "AGENT_DATASETS_OPERATION_LOG_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE AGENT_TEAM_INVITE_CODE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."AGENT_TEAM_INVITE_CODE" ADD CONSTRAINT "AGENT_TEAM_INVITE_CODE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE AGENT_TEAM_MEMBERS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."AGENT_TEAM_MEMBERS" ADD CONSTRAINT "AGENT_TEAM_MEMBERS_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE AGENT_TEAM_USER_LOG
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."AGENT_TEAM_USER_LOG" ADD CONSTRAINT "AGENT_TEAM_USER_LOG_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE AGENT_TEAMS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."AGENT_TEAMS" ADD CONSTRAINT "AGENT_TEAMS_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE AGT_APP_DIR
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."AGT_APP_DIR" ADD CONSTRAINT "AGT_APP_DIR_PK" PRIMARY KEY ("DIR_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE AGT_APP_DIR_KIND
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."AGT_APP_DIR_KIND" ADD CONSTRAINT "AGT_APP_DIR_KIND_PK" PRIMARY KEY ("KIND_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE AGT_APP_PARAM
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."AGT_APP_PARAM" ADD CONSTRAINT "AGT_APP_PARAM_PK" PRIMARY KEY ("APP_PARAM_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE AGT_APP_REL_AGENT
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."AGT_APP_REL_AGENT" ADD CONSTRAINT "AGT_APP_REL_AGENT_PK" PRIMARY KEY ("APP_REL_AGENT_ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE AGT_DECISION_INFO
-- ----------------------------
CREATE INDEX "IDX_CHATITEMID_TYPE" ON "KNOWLEDGE"."AGT_DECISION_INFO" USING BTREE (
  "CHAT_ITEM_ID" COLLATE "PG_CATALOG"."DEFAULT" "PG_CATALOG"."TEXT_OPS" ASC NULLS LAST,
  "TIME" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE AGT_DECISION_INFO
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."AGT_DECISION_INFO" ADD CONSTRAINT "AGT_PECISION_INFO_PKEY" PRIMARY KEY ("DECISION_ID", "APP_ID", "CHAT_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE AGT_FEEDBACK_INFO
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."AGT_FEEDBACK_INFO" ADD CONSTRAINT "AGT_FEEDBACK_INFO_PKEY" PRIMARY KEY ("APP_ID", "CHAT_ID", "CHAT_ITEM_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE AGT_MODEL_GROUP_INFO
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."AGT_MODEL_GROUP_INFO" ADD CONSTRAINT "AGT_MODEL_GROUP_INFO_PKEY" PRIMARY KEY ("GROUP_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE AGT_MODEL_GROUP_REL
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."AGT_MODEL_GROUP_REL" ADD CONSTRAINT "AGT_MODEL_GROUP_REL_PKEY" PRIMARY KEY ("REL_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE AGT_MODEL_LOAD
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."AGT_MODEL_LOAD" ADD CONSTRAINT "AGT_MODEL_LOAD_PKEY" PRIMARY KEY ("MODEL_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE AGT_MODEL_RECORD
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."AGT_MODEL_RECORD" ADD CONSTRAINT "AGT_MODEL_RECORD_PKEY" PRIMARY KEY ("USE_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE AGT_PLUGIN_APP_SOURCE_INFO
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."AGT_PLUGIN_APP_SOURCE_INFO" ADD CONSTRAINT "AGT_PLUGIN_APP_SOURCE_INFO_PK" PRIMARY KEY ("SOURCE_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE AGT_SCRIPT_INFO_RELEASE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."AGT_SCRIPT_INFO_RELEASE" ADD CONSTRAINT "AGT_SCRIPT_INFO_RELEASE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE AGT_SYSTEM_PARAM_INFO
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."AGT_SYSTEM_PARAM_INFO" ADD CONSTRAINT "AGT_SYSTEM_PARAM_INFO_PKEY" PRIMARY KEY ("SYS_PARAM_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE AI_MODEL
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."AI_MODEL" ADD CONSTRAINT "AI_MODEL_PKEY" PRIMARY KEY ("MODEL_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE AI_MODEL_2
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."AI_MODEL_2" ADD CONSTRAINT "AI_MODEL_2_PKEY" PRIMARY KEY ("MODEL_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE APP_DIR
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."APP_DIR" ADD CONSTRAINT "APP_DIR_PKEY" PRIMARY KEY ("DIR_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE APP_FLOW_LOG
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."APP_FLOW_LOG" ADD CONSTRAINT "APP_FLOW_LOG_COPY1_PKEY" PRIMARY KEY ("APP_FLOW_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE APP_MCP_JAR_INFO
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."APP_MCP_JAR_INFO" ADD CONSTRAINT "APP_MCP_JAR_INFO_PKEY2" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE APP_MCP_JAR_INFO_RELEASE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."APP_MCP_JAR_INFO_RELEASE" ADD CONSTRAINT "APP_MCP_JAR_INFO_RELEASE_PKEY2" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE APP_OPEN_MAN
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."APP_OPEN_MAN" ADD CONSTRAINT "APP_OPEN_MAN_PKEY" PRIMARY KEY ("OPEN_MAN_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE APP_OPENAPI_DOC
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."APP_OPENAPI_DOC" ADD CONSTRAINT "APP_OPENAPI_DOC_PK" PRIMARY KEY ("I_ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE APP_VERSION_DRAFT
-- ----------------------------
CREATE INDEX "IDX_DRAFT_INFO_ID" ON "KNOWLEDGE"."APP_VERSION_DRAFT" USING BTREE (
  "VERSION_INFO_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE APP_VERSION_DRAFT
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."APP_VERSION_DRAFT" ADD CONSTRAINT "APP_VERSION_DRAFT_PKEY" PRIMARY KEY ("DRAFT_ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE APP_VERSION_INFO
-- ----------------------------
CREATE INDEX "IDX_VERSION_APP_ID" ON "KNOWLEDGE"."APP_VERSION_INFO" USING BTREE (
  "APP_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);
CREATE UNIQUE INDEX "UK_VERSION_ID" ON "KNOWLEDGE"."APP_VERSION_INFO" USING BTREE (
  "APP_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "VERSION_TYPE" COLLATE "PG_CATALOG"."DEFAULT" "PG_CATALOG"."BPCHAR_OPS" ASC NULLS LAST,
  "VERSION_NUM" COLLATE "PG_CATALOG"."DEFAULT" "PG_CATALOG"."TEXT_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE APP_VERSION_INFO
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."APP_VERSION_INFO" ADD CONSTRAINT "APP_VERSION_INFO_PKEY" PRIMARY KEY ("VERSION_INFO_ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE APP_VERSION_PUBLISH
-- ----------------------------
CREATE INDEX "IDX_PUBLISH_INFO_ID" ON "KNOWLEDGE"."APP_VERSION_PUBLISH" USING BTREE (
  "VERSION_INFO_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE APP_VERSION_PUBLISH
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."APP_VERSION_PUBLISH" ADD CONSTRAINT "APP_VERSION_PUBLISH_PKEY" PRIMARY KEY ("PUBLISH_ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE APP_VERSION_REL
-- ----------------------------
CREATE INDEX "IDX_REL_INFO_ID" ON "KNOWLEDGE"."APP_VERSION_REL" USING BTREE (
  "VERSION_INFO_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE APP_VERSION_REL
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."APP_VERSION_REL" ADD CONSTRAINT "APP_VERSION_REL_PKEY" PRIMARY KEY ("REL_ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE APPS
-- ----------------------------
CREATE INDEX "APPS_CREATE_USER_INDEX" ON "KNOWLEDGE"."APPS" USING BTREE (
  "CREATE_USER" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE APPS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."APPS" ADD CONSTRAINT "APPS_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE APPS_FAVORITE
-- ----------------------------
CREATE INDEX "APPS_FAVORITE_APP_ID_INDEX" ON "KNOWLEDGE"."APPS_FAVORITE" USING BTREE (
  "APP_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE APPS_FAVORITE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."APPS_FAVORITE" ADD CONSTRAINT "APPS_FAVORITE_PKEY" PRIMARY KEY ("APPS_FAVORITE_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE APPS_LABEL_HINT
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."APPS_LABEL_HINT" ADD CONSTRAINT "APPS_LABEL_HINT_PKEY" PRIMARY KEY ("APPS_ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE APPS_RELEASE
-- ----------------------------
CREATE INDEX "APPS_RELEASE_CREATE_USER_INDEX" ON "KNOWLEDGE"."APPS_RELEASE" USING BTREE (
  "CREATE_USER" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);
CREATE INDEX "APPS_RELEASE_ID_INDEX" ON "KNOWLEDGE"."APPS_RELEASE" USING BTREE (
  "ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE APPS_RELEASE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."APPS_RELEASE" ADD CONSTRAINT "APPS_RELEASE_PKEY" PRIMARY KEY ("TABLE_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE APPS_USER_EVAL
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."APPS_USER_EVAL" ADD CONSTRAINT "APP_USER_EVAL_PKEY" PRIMARY KEY ("APPS_USER_EVAL_ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE ASSISTANT_CHAT_ITEMS
-- ----------------------------
CREATE INDEX "ASSISTANT_CHAT_ITEMS_CREATE_TIME_INDEX" ON "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS" USING BTREE (
  "CREATE_TIME" "PG_CATALOG"."TIMESTAMP_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE ASSISTANT_CHAT_ITEMS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."ASSISTANT_CHAT_ITEMS" ADD CONSTRAINT "GAIXC_AGENT_ASSISTANT_CHAT_ITEMS_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE ASSISTANT_SESSION_CHAT_ITEMS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."ASSISTANT_SESSION_CHAT_ITEMS" ADD CONSTRAINT "GAIXC_AGENT_ASSISTANT_SESSION_CHAT_ITEMS_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE BULLETIN_DIGEST
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."BULLETIN_DIGEST" ADD CONSTRAINT "CHAPTER_DIGEST_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE BULLETIN_DOCUMENT
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."BULLETIN_DOCUMENT" ADD CONSTRAINT "BULLETIN_DOCUMENT_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE BULLETIN_GENERATOR_ITEM
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."BULLETIN_GENERATOR_ITEM" ADD CONSTRAINT "BULLETIN_GENERATOR_ITEM_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE BULLETIN_LABLE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."BULLETIN_LABLE" ADD CONSTRAINT "CHAPTER_LABLE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE BULLETIN_OUTLINE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."BULLETIN_OUTLINE" ADD CONSTRAINT "CHAPTER_OUTLINE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE BULLETIN_PROGRESS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."BULLETIN_PROGRESS" ADD CONSTRAINT "BULLETIN_PROGRESS_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE BULLETIN_PROMPT_TONE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."BULLETIN_PROMPT_TONE" ADD CONSTRAINT "BULLETIN_PROMPT_TONE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE CHAT_DATASET
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."CHAT_DATASET" ADD CONSTRAINT "CHAT_DATASET_PKEY" PRIMARY KEY ("DATASET_ID", "CHAT_DATASET_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE CHAT_FILE_INFO
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."CHAT_FILE_INFO" ADD CONSTRAINT "CHAT_FILE_INFO_PKEY" PRIMARY KEY ("I_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE CHAT_FILEUPLOAD
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."CHAT_FILEUPLOAD" ADD CONSTRAINT "CHAT_FILEUPLOAD_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE CHAT_ITEMS
-- ----------------------------
CREATE INDEX "CHAT_DETAIL_INDEX" ON "KNOWLEDGE"."CHAT_ITEMS" USING BTREE (
  "APP_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "OBJ" COLLATE "PG_CATALOG"."DEFAULT" "PG_CATALOG"."TEXT_OPS" ASC NULLS LAST,
  "SUB_APP_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "REL_MODEL_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "CREATE_TIME" "PG_CATALOG"."TIMESTAMP_OPS" ASC NULLS LAST
);
CREATE INDEX "CHAT_ITEMS_APP_ID_IDX_COPY1" ON "KNOWLEDGE"."CHAT_ITEMS" USING BTREE (
  "APP_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "CHAT_ID" COLLATE "PG_CATALOG"."DEFAULT" "PG_CATALOG"."TEXT_OPS" ASC NULLS LAST,
  "TEAM_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "CREATE_TIME" "PG_CATALOG"."TIMESTAMP_OPS" ASC NULLS LAST
);
CREATE INDEX "CHAT_ITEMS_CREATE_TIME_INDEX" ON "KNOWLEDGE"."CHAT_ITEMS" USING BTREE (
  "CREATE_TIME" "PG_CATALOG"."TIMESTAMP_OPS" ASC NULLS LAST
);
CREATE INDEX "CHAT_ITEMS_INDEX_CHAT_ID" ON "KNOWLEDGE"."CHAT_ITEMS" USING BTREE (
  "CHAT_ID" COLLATE "PG_CATALOG"."DEFAULT" "PG_CATALOG"."TEXT_OPS" ASC NULLS LAST
);
CREATE INDEX "IDX_OBJ_APP_ID" ON "KNOWLEDGE"."CHAT_ITEMS" USING BTREE (
  "OBJ" COLLATE "PG_CATALOG"."DEFAULT" "PG_CATALOG"."TEXT_OPS" ASC NULLS LAST,
  "APP_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);
CREATE INDEX "IDX_OBJ_APP_ID_TIME" ON "KNOWLEDGE"."CHAT_ITEMS" USING BTREE (
  "OBJ" COLLATE "PG_CATALOG"."DEFAULT" "PG_CATALOG"."TEXT_OPS" ASC NULLS LAST,
  "CREATE_TIME" "PG_CATALOG"."TIMESTAMP_OPS" ASC NULLS LAST,
  "APP_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE CHAT_ITEMS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."CHAT_ITEMS" ADD CONSTRAINT "CHAT_ITEMS_COPY1_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE CHATS
-- ----------------------------
CREATE INDEX "CHATS_APP_ID_INDEX" ON "KNOWLEDGE"."CHATS" USING BTREE (
  "APP_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);
CREATE INDEX "IDX_CHATS_CHAT_ID" ON "KNOWLEDGE"."CHATS" USING BTREE (
  "CHAT_ID" COLLATE "PG_CATALOG"."DEFAULT" "PG_CATALOG"."TEXT_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE CHATS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."CHATS" ADD CONSTRAINT "CHATS_COPY1_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE CODE_MODEL
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."CODE_MODEL" ADD CONSTRAINT "CODE_MODEL_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE DATASET_CHUNK_TERM_REF
-- ----------------------------
CREATE INDEX "DATASET_CHUNK_TERM_REF_DATASET_CHUNK_ID_IDX" ON "KNOWLEDGE"."DATASET_CHUNK_TERM_REF" USING BTREE (
  "DATASET_CHUNK_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "DATASET_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "FILE_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "TERM_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "TEAM_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE DATASET_CHUNK_TERM_REF
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."DATASET_CHUNK_TERM_REF" ADD CONSTRAINT "DATASETS_DATA_CHUNCK_TERM_REL_PK" PRIMARY KEY ("REL_ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE DATASET_CHUNKS
-- ----------------------------
CREATE INDEX "DATASET_CHUNKS_FILES_ID_IDX" ON "KNOWLEDGE"."DATASET_CHUNKS" USING BTREE (
  "FILES_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "DATASET_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);
CREATE INDEX "IDX_DATASET_CHUNKS_FILE_INDEX" ON "KNOWLEDGE"."DATASET_CHUNKS" USING BTREE (
  "FILES_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "N" "PG_CATALOG"."INT4_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE DATASET_CHUNKS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."DATASET_CHUNKS" ADD CONSTRAINT "DATASET_CHUNKS_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE DATASET_COLLECTION_TERM_REF
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."DATASET_COLLECTION_TERM_REF" ADD CONSTRAINT "DATASETS_CATE_TERM_REL_PK" PRIMARY KEY ("REL_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE DATASET_COLLECTIONS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."DATASET_COLLECTIONS" ADD CONSTRAINT "DATASET_COLLECTIONS_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE DATASET_DATA_TERM_REF
-- ----------------------------
CREATE INDEX "DATASET_DATA_TERM_REF_TERM_ID_IDX" ON "KNOWLEDGE"."DATASET_DATA_TERM_REF" USING BTREE (
  "TERM_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "DATASET_DATAS_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "DATASET_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "TEAM_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "TYPE_TERM_ID" COLLATE "PG_CATALOG"."DEFAULT" "PG_CATALOG"."TEXT_OPS" ASC NULLS LAST,
  "FILE_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE DATASET_DATA_TERM_REF
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."DATASET_DATA_TERM_REF" ADD CONSTRAINT "DATASETS_DATA_TERM_REL_PK" PRIMARY KEY ("REL_ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE DATASET_DATAS
-- ----------------------------
CREATE INDEX "FILE_ID_INDEX" ON "KNOWLEDGE"."DATASET_DATAS" USING BTREE (
  "FILE_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE DATASET_DATAS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."DATASET_DATAS" ADD CONSTRAINT "DATASET_DATAS_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE DATASET_FILE_DIR
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."DATASET_FILE_DIR" ADD CONSTRAINT "DATASET_FILE_DIR_PKEY" PRIMARY KEY ("FILE_DIR_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE DATASET_FILE_TERM_REF
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."DATASET_FILE_TERM_REF" ADD CONSTRAINT "DATASETS_FILE_TERM_REL_PK" PRIMARY KEY ("REL_ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE DATASET_FILES
-- ----------------------------
CREATE INDEX "IDX_DATASET_DOC" ON "KNOWLEDGE"."DATASET_FILES" USING BTREE (
  "DATASET_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "DOC_ID" "PG_CATALOG"."INT4_OPS" ASC NULLS LAST,
  "ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "FILE_NAME" COLLATE "PG_CATALOG"."DEFAULT" "PG_CATALOG"."TEXT_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE DATASET_FILES
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."DATASET_FILES" ADD CONSTRAINT "DATASET_FILES_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE DATASET_FOLDER
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."DATASET_FOLDER" ADD CONSTRAINT "ASSISTANT_CHAT_ITEMS_COPY1_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE DATASET_FOLDER_FILE_TAG
-- ----------------------------
CREATE UNIQUE INDEX "UID_FOLDER_FILE_TAG" ON "KNOWLEDGE"."DATASET_FOLDER_FILE_TAG" USING BTREE (
  "TYPE" "PG_CATALOG"."INT4_OPS" ASC NULLS LAST,
  "TAG_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "REF_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE DATASET_FOLDER_FILE_TAG
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."DATASET_FOLDER_FILE_TAG" ADD CONSTRAINT "DATASET_FOLDER_COPY1_PKEY1" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE DATASET_IT_QUERY_REL
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."DATASET_IT_QUERY_REL" ADD CONSTRAINT "DATASET_IT_QUERY_REL_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE DATASET_IT_QUERY_REL_HISTORY
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."DATASET_IT_QUERY_REL_HISTORY" ADD CONSTRAINT "DATASET_IT_QUERY_REL_HISTORY_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE DATASET_LOGOS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."DATASET_LOGOS" ADD CONSTRAINT "DATASET_LOGOS_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE DATASET_SHARE_ADD_BAK
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."DATASET_SHARE_ADD_BAK" ADD CONSTRAINT "DATASET_SHARE_ADD_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE DATASET_SHARE_BAK
-- ----------------------------
CREATE INDEX "DATASETS_SHARE_DATASETID_KEY" ON "KNOWLEDGE"."DATASET_SHARE_BAK" USING BTREE (
  "DATASET_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE DATASET_SHARE_BAK
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."DATASET_SHARE_BAK" ADD CONSTRAINT "DATASETS_SHARE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE DATASET_SHARE_FAVORITE_BAK
-- ----------------------------
CREATE UNIQUE INDEX "DATASET_SHARE_FAVORITE_UINDEX1" ON "KNOWLEDGE"."DATASET_SHARE_FAVORITE_BAK" USING BTREE (
  "DATASET_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "DATASET_SHARE_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "CREATE_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE DATASET_SHARE_FAVORITE_BAK
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."DATASET_SHARE_FAVORITE_BAK" ADD CONSTRAINT "DATASET_SHARE_FAVORITE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE DATASET_SHARE_ITEMS_BAK
-- ----------------------------
CREATE INDEX "DATASET_SHARE_ITEMS_DATASETID_KEY" ON "KNOWLEDGE"."DATASET_SHARE_ITEMS_BAK" USING BTREE (
  "DATASET_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE DATASET_SHARE_ITEMS_BAK
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."DATASET_SHARE_ITEMS_BAK" ADD CONSTRAINT "DATASETS_SHARE_ITEM_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE DATASET_TAG
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."DATASET_TAG" ADD CONSTRAINT "DATASET_FOLDER_COPY1_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE DATASET_TERM_REF
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."DATASET_TERM_REF" ADD CONSTRAINT "DATASET_TERM_REF_PKEY" PRIMARY KEY ("REL_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE DATASETS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."DATASETS" ADD CONSTRAINT "DATASETS_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE EDITING_REVIEW_TERMS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."EDITING_REVIEW_TERMS" ADD CONSTRAINT "EDITING_REVIEW_TERMS_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE EDITING_REVIEW_TERMS_CONTENT
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."EDITING_REVIEW_TERMS_CONTENT" ADD CONSTRAINT "EDITING_REVIEW_TERMS_CONTENT_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE EDITING_REVIEW_TERMS_EXPAND
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."EDITING_REVIEW_TERMS_EXPAND" ADD CONSTRAINT "EDITING_REVIEW_TERMS_EXPAND_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE EDITING_REVIEW_TERMS_LABLE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."EDITING_REVIEW_TERMS_LABLE" ADD CONSTRAINT "EDITING_REVIEW_TERMS_LABLE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE EMPLOYEES
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."EMPLOYEES" ADD CONSTRAINT "EMPLOYEES_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE EVALUATE_FILE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."EVALUATE_FILE" ADD CONSTRAINT "EVALUATE_FILE_PK" PRIMARY KEY ("EVALUATE_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE EVALUATE_FILE_DETAIL
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."EVALUATE_FILE_DETAIL" ADD CONSTRAINT "EVALUATE_FILE_DETAIL_PK" PRIMARY KEY ("DETAIL_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE EVALUATE_LLM_JUDGE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."EVALUATE_LLM_JUDGE" ADD CONSTRAINT "EVALUATE_LLM_JUDGE_PK" PRIMARY KEY ("JUDGE_LOG_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE EXT_INTERFACE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."EXT_INTERFACE" ADD CONSTRAINT "EXT_INTERFACE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE EXT_SECRET
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."EXT_SECRET" ADD CONSTRAINT "EXT_SECRET_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE FILE_CONTENT_INFO
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."FILE_CONTENT_INFO" ADD CONSTRAINT "FILE_CONTENT_INFO_PK" PRIMARY KEY ("CONTENT_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE FILE_SEGMENT_INFO
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."FILE_SEGMENT_INFO" ADD CONSTRAINT "FILE_SEGMENT_INFO_PKEY" PRIMARY KEY ("FILE_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE FILE_SEGMENT_INFO_COPY1
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."FILE_SEGMENT_INFO_COPY1" ADD CONSTRAINT "FILE_SEGMENT_INFO_COPY1_PKEY" PRIMARY KEY ("FILE_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE FILE_SEGMENT_STATE_INFO
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."FILE_SEGMENT_STATE_INFO" ADD CONSTRAINT "FILE_SEGMENT_STATE_INFO_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE FILE_SPLIT_COST
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."FILE_SPLIT_COST" ADD CONSTRAINT "FILE_SPLIT_COST_PKEY" PRIMARY KEY ("COST_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE FILE_TASK_INST
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."FILE_TASK_INST" ADD CONSTRAINT "FILE_TASK_INST_COPY1_PKEY" PRIMARY KEY ("I_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE FILE_TPL_CONTENT_FEATURE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."FILE_TPL_CONTENT_FEATURE" ADD CONSTRAINT "FILE_TPL_CONTENT_FEATURE_PK" PRIMARY KEY ("CREAT_FLOW_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE FILE_TPL_FEATURE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."FILE_TPL_FEATURE" ADD CONSTRAINT "FILE_TPL_FEATURE_PK" PRIMARY KEY ("CREAT_FLOW_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE FILE_TPL_MAN
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."FILE_TPL_MAN" ADD CONSTRAINT "FILE_TPL_MAN_PK" PRIMARY KEY ("FILE_TPL_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE FILE_TPL_MAN_CATALOG
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."FILE_TPL_MAN_CATALOG" ADD CONSTRAINT "FILE_TPL_MAN_CATALOG_PK" PRIMARY KEY ("I_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE FILE_UPLOAD_RECORD
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."FILE_UPLOAD_RECORD" ADD CONSTRAINT "FILE_UPLOAD_RECORD_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_BUSINESS_DOMAIN_UPDATE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_BUSINESS_DOMAIN_UPDATE" ADD CONSTRAINT "GAIXC_AGENT_BUSINESS_DOMAIN_UPDATE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_DATASET_AUDIT
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT" ADD CONSTRAINT "DATASET_AUDIT_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_DATASET_AUDIT_RECORD
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_DATASET_AUDIT_RECORD" ADD CONSTRAINT "DATASET_AUDIT_RECORD_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE GAIXC_AGENT_DATASET_SHARE
-- ----------------------------
CREATE INDEX "GAIXC_AGENT_DATASETS_SHARE_DATASETID_KEY" ON "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE" USING BTREE (
  "DATASET_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_DATASET_SHARE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE" ADD CONSTRAINT "GAIXC_AGENT_DATASETS_SHARE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE GAIXC_AGENT_DATASET_SHARE_ADD
-- ----------------------------
CREATE UNIQUE INDEX "GAIXC_AGENT_DATASET_SHARE_ADD_UINDEX_1" ON "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ADD" USING BTREE (
  "DATASET_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "ADD_TYPE" "PG_CATALOG"."INT2_OPS" ASC NULLS LAST,
  "USER_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "AGENT_TEAM_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_DATASET_SHARE_ADD
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ADD" ADD CONSTRAINT "GAIXC_AGENT_DATASET_SHARE_ADD_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE GAIXC_AGENT_DATASET_SHARE_FAVORITE
-- ----------------------------
CREATE UNIQUE INDEX "GAIXC_AGENT_DATASET_SHARE_FAVORITE_UINDEX1" ON "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_FAVORITE" USING BTREE (
  "DATASET_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "DATASET_SHARE_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "CREATE_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_DATASET_SHARE_FAVORITE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_FAVORITE" ADD CONSTRAINT "GAIXC_AGENT_DATASET_SHARE_FAVORITE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE GAIXC_AGENT_DATASET_SHARE_ITEMS
-- ----------------------------
CREATE INDEX "GAIXC_AGENT_DATASET_SHARE_ITEMS_DATASETID_KEY" ON "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ITEMS" USING BTREE (
  "DATASET_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_DATASET_SHARE_ITEMS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_DATASET_SHARE_ITEMS" ADD CONSTRAINT "GAIXC_AGENT_DATASET_SHARE_ITEMS_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_DATASETS_INVOKING_LOG
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_DATASETS_INVOKING_LOG" ADD CONSTRAINT "GAIXC_AGENT_DATASETS_INVOKING_LOG_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_GDAICO_CALL
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_GDAICO_CALL" ADD CONSTRAINT "GAIXC_AGENT_GDAICO_CALL_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_HINT_SHOW
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_HINT_SHOW" ADD CONSTRAINT "GAIXC_AGENT_DATASET_HINT_SHOW_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE GAIXC_AGENT_PLATFORM_AGENT_ACCESS_RECORD
-- ----------------------------
CREATE INDEX "APP_ID_PKEY" ON "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_AGENT_ACCESS_RECORD" USING BTREE (
  "APP_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);
CREATE INDEX "CREATE_ID_PKEY" ON "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_AGENT_ACCESS_RECORD" USING BTREE (
  "CREATE_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_PLATFORM_AGENT_ACCESS_RECORD
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_AGENT_ACCESS_RECORD" ADD CONSTRAINT "GAIXC_AGENT_PLATFORM_AGENT_ACCESS_RECORD_REL_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_PLATFORM_AGENT_TEAM_PERMISSION_INFO
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_AGENT_TEAM_PERMISSION_INFO" ADD CONSTRAINT "GAIXC_AGENT_PLATFORM_AGENT_TEAM_AUTH_INFO_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_PLATFORM_APP_BI_REL
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APP_BI_REL" ADD CONSTRAINT "GAIXC_AGENT_PLATFORM_APP_BI_REL_PKEY" PRIMARY KEY ("REL_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_PLATFORM_APPS_TEMPLATE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE" ADD CONSTRAINT "GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE" ADD CONSTRAINT "GAIXC_AGENT_PLATFORM_APPS_TEMPLATE_MODULE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM" ADD CONSTRAINT "GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM_PKEY" PRIMARY KEY ("BI_CHAT_REL_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM_DETAIL
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM_DETAIL" ADD CONSTRAINT "GAIXC_AGENT_PLATFORM_BI_CHAT_ITEM_DETAIL_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_PLATFORM_BI_FILE_INFO
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_BI_FILE_INFO" ADD CONSTRAINT "GAIXC_AGENT_PLATFORM_BI_FILE_INFO_PKEY" PRIMARY KEY ("DOCUMENT_ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD
-- ----------------------------
CREATE INDEX "APP_ID_KEY" ON "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD" USING BTREE (
  "APP_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);
CREATE INDEX "CHAT_ITEM_ID_KEY" ON "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD" USING BTREE (
  "CHAT_ITEM_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD" ADD CONSTRAINT "GAIXC_AGENT_PLATFORM_CHAT_WORD_CLOUD_REL_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_PLATFORM_DATABASE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE" ADD CONSTRAINT "DATABASE_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_PLATFORM_DATABASE_FIELD
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FIELD" ADD CONSTRAINT "DATABASE_FIELD_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_PLATFORM_DATABASE_FILE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE" ADD CONSTRAINT "DATABASE_FILE_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_PLATFORM_DATABASE_FILE_DATA
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_DATA" ADD CONSTRAINT "DATABASE_FILE_DATA_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_PLATFORM_DATABASE_FILE_TEMP
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FILE_TEMP" ADD CONSTRAINT "DATABASE_FILE_TEMP_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_PLATFORM_DATABASE_FOLDER
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATABASE_FOLDER" ADD CONSTRAINT "DATABASE_FOLDER_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_PLATFORM_DATASETS_LOG
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_LOG" ADD CONSTRAINT "GAIXC_AGENT_PLATFORM_DATASETS_LOG_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_PLATFORM_DATASETS_TOPIC
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_DATASETS_TOPIC" ADD CONSTRAINT "GAIXC_AGENT_PLATFORM_DATASETS_TOPIC_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_PLATFORM_USER_RERANK_REL
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_PLATFORM_USER_RERANK_REL" ADD CONSTRAINT "GAIXC_AGENT_PLATFORM_USER_RERANK_REL_PKEY" PRIMARY KEY ("USER_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE GAIXC_AGENT_WATTPC_JUMP_INFO
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."GAIXC_AGENT_WATTPC_JUMP_INFO" ADD CONSTRAINT "GAIXC_AGENT_WATTPC_JUMP_INFO_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE HIGH_CODE_TEMPLATE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."HIGH_CODE_TEMPLATE" ADD CONSTRAINT "HIGH_CODE_TEMPLATE_PKEY" PRIMARY KEY ("TEMPLATE_ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE IM_AGENT_DATASET_UPLOAD_FILE_TEMP_INFO
-- ----------------------------
CREATE INDEX "UPLOAD_TEMP_FILE_INDEX" ON "KNOWLEDGE"."IM_AGENT_DATASET_UPLOAD_FILE_TEMP_INFO" USING BTREE (
  "DATASET_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE IM_AGENT_DATASET_UPLOAD_FILE_TEMP_INFO
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."IM_AGENT_DATASET_UPLOAD_FILE_TEMP_INFO" ADD CONSTRAINT "IM_AGENT_DATASET_UPLOAD_FILE_TEMP_INFO_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE IM_AGENT_PLUGIN_CANCEL_SHARE_LOG
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."IM_AGENT_PLUGIN_CANCEL_SHARE_LOG" ADD CONSTRAINT "IM_AGENT_PLUGIN_CANCEL_SHARE_LOG_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE IM_AGENT_PLUGIN_SHARE_LOG
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."IM_AGENT_PLUGIN_SHARE_LOG" ADD CONSTRAINT "IM_AGENT_PLUGIN_SHARE_LOG_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE IM_AGENT_PLUGIN_UPVOTE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."IM_AGENT_PLUGIN_UPVOTE" ADD CONSTRAINT "IM_AGENT_PLUGIN_UPVOTE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE IM_AGENT_REVIEW_OPERATION_LOG
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."IM_AGENT_REVIEW_OPERATION_LOG" ADD CONSTRAINT "IM_AGENT_REVIEW_OPERATION_LOG_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE IM_AGENT_REVIEW_PROJECT_FILE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."IM_AGENT_REVIEW_PROJECT_FILE" ADD CONSTRAINT "IM_AGENT_REVIEW_PROJECT_FILE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE IM_AGENT_REVIEW_SENSITIVE_WORD
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."IM_AGENT_REVIEW_SENSITIVE_WORD" ADD CONSTRAINT "IM_AGENT_REVIEW_SENSITIVE_WORD_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE IM_AGENT_REVIEW_USERS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."IM_AGENT_REVIEW_USERS" ADD CONSTRAINT "IM_AGENT_REVIEW_USERS_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE IM_AGENT_WORKFLOW_DEBUG_LOG
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."IM_AGENT_WORKFLOW_DEBUG_LOG" ADD CONSTRAINT "IM_AGENT_WORKFLOW_DEBUG_LOG_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE IM_MCP_SERVER_DETAIL
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."IM_MCP_SERVER_DETAIL" ADD CONSTRAINT "APP_MCP_JAR_INFO_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE IM_MCP_SERVER_DETAIL_RELEASE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."IM_MCP_SERVER_DETAIL_RELEASE" ADD CONSTRAINT "APP_MCP_JAR_INFO_RELEASE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE IM_MCP_SERVER_INFO
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."IM_MCP_SERVER_INFO" ADD CONSTRAINT "APP_MCP_INFO_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE IM_MCP_SERVER_INFO_RELEASE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."IM_MCP_SERVER_INFO_RELEASE" ADD CONSTRAINT "APP_MCP_INFO_RELEASE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE IM_MODEL_CONCURRENCY
-- ----------------------------
CREATE INDEX "IM_MODEL_CONCURRENCY_BATCH_DATE_IDX" ON "KNOWLEDGE"."IM_MODEL_CONCURRENCY" USING BTREE (
  "BATCH_DATE" COLLATE "PG_CATALOG"."DEFAULT" "PG_CATALOG"."TEXT_OPS" ASC NULLS LAST
);
CREATE INDEX "IM_MODEL_CONCURRENCY_MODEL_NAME_IDX" ON "KNOWLEDGE"."IM_MODEL_CONCURRENCY" USING BTREE (
  "MODEL_NAME" COLLATE "PG_CATALOG"."DEFAULT" "PG_CATALOG"."TEXT_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE IM_MODEL_CONCURRENCY
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."IM_MODEL_CONCURRENCY" ADD CONSTRAINT "IM_MODEL_CONCURRENCY_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE IM_USER_CONCURRENCY
-- ----------------------------
CREATE INDEX "IM_USER_CONCURRENCY_BATCH_DATE_IDX" ON "KNOWLEDGE"."IM_USER_CONCURRENCY" USING BTREE (
  "BATCH_DATE" COLLATE "PG_CATALOG"."DEFAULT" "PG_CATALOG"."TEXT_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE IM_USER_CONCURRENCY
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."IM_USER_CONCURRENCY" ADD CONSTRAINT "IM_USER_CONCURRENCY_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE IMAGES
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."IMAGES" ADD CONSTRAINT "IMAGES_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE INTELLIGENT_BULLETIN
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."INTELLIGENT_BULLETIN" ADD CONSTRAINT "INTELLIGENT_BULLETIN_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE KNOW_CREAT_FLOW
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."KNOW_CREAT_FLOW" ADD CONSTRAINT "KNOW_CREAT_FLOW_PK" PRIMARY KEY ("CREAT_FLOW_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE KNOW_CREAT_FLOW_LOG
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."KNOW_CREAT_FLOW_LOG" ADD CONSTRAINT "KNOW_CREAT_FLOW_LOG_PK" PRIMARY KEY ("CREAT_FLOW_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE LANGFLOW_MODULE_INFO
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."LANGFLOW_MODULE_INFO" ADD CONSTRAINT "LANGFLOW_MODULE_INFO_PKEY" PRIMARY KEY ("MODULE_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE LM_AGENT_FLOW_RELEASE_VERSION
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."LM_AGENT_FLOW_RELEASE_VERSION" ADD CONSTRAINT "LM_AGENT_FLOW_RELEASE_VERSION_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE LM_AGENT_FUNC_LABEL
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."LM_AGENT_FUNC_LABEL" ADD CONSTRAINT "LM_AGENT_FUNC_LABEL_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE LM_AGENT_PLUGIN_ADD
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_ADD" ADD CONSTRAINT "LM_AGENT_PLUGIN_ADD_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE LM_AGENT_PLUGIN_FAVORITE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_FAVORITE" ADD CONSTRAINT "LM_AGENT_PLUGIN_FAVORITE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE LM_AGENT_PLUGIN_MACHINE_EXAMPLE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_EXAMPLE" ADD CONSTRAINT "LM_AGENT_PLUGIN_MACHINE_EXAMPLE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE LM_AGENT_PLUGIN_MACHINE_STATISTICS
-- ----------------------------
CREATE INDEX "IDX_MACHINEID_PLUGINID" ON "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS" USING BTREE (
  "PLUGIN_MACHINE_ID" COLLATE "PG_CATALOG"."DEFAULT" "PG_CATALOG"."TEXT_OPS" ASC NULLS LAST,
  "PLUGIN_APP_ID" COLLATE "PG_CATALOG"."DEFAULT" "PG_CATALOG"."TEXT_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE LM_AGENT_PLUGIN_MACHINE_STATISTICS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_MACHINE_STATISTICS" ADD CONSTRAINT "LM_AGENT_PLUGIN_MACHINE_STATISTICS_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE LM_AGENT_PLUGIN_RELEASE_VERSION
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_RELEASE_VERSION" ADD CONSTRAINT "LM_AGENT_PLUGIN_RELEASE_VERSION_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE LM_AGENT_PLUGIN_SHARE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE" ADD CONSTRAINT "LM_AGENT_PLUGIN_SHARE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE LM_AGENT_PLUGIN_SHARE_ITEM
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_SHARE_ITEM" ADD CONSTRAINT "LM_AGENT_PLUGIN_SHARE_ITEM_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE LM_AGENT_PLUGIN_STATISTICS
-- ----------------------------
CREATE INDEX "IDX_PLUGINID" ON "KNOWLEDGE"."LM_AGENT_PLUGIN_STATISTICS" USING BTREE (
  "PLUGIN_APP_ID" COLLATE "PG_CATALOG"."DEFAULT" "PG_CATALOG"."TEXT_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE LM_AGENT_PLUGIN_STATISTICS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."LM_AGENT_PLUGIN_STATISTICS" ADD CONSTRAINT "LM_AGENT_PLUGIN_STATISTICS_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE LM_AGENT_REL_WORKFLOW_PLUGIN_INFO
-- ----------------------------
CREATE INDEX "IDX_PLUGIN_APP_ID" ON "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO" USING BTREE (
  "PLUGIN_APP_ID" COLLATE "PG_CATALOG"."DEFAULT" "PG_CATALOG"."TEXT_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE LM_AGENT_REL_WORKFLOW_PLUGIN_INFO
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO" ADD CONSTRAINT "REL_WORKFLOW_PLUGIN_INFO_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE LM_AGENT_REL_WORKFLOW_PLUGIN_INFO_RELEASE
-- ----------------------------
CREATE INDEX "IDX_PLUGIN_APP_ID_COPY1" ON "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO_RELEASE" USING BTREE (
  "PLUGIN_APP_ID" COLLATE "PG_CATALOG"."DEFAULT" "PG_CATALOG"."TEXT_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE LM_AGENT_REL_WORKFLOW_PLUGIN_INFO_RELEASE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."LM_AGENT_REL_WORKFLOW_PLUGIN_INFO_RELEASE" ADD CONSTRAINT "REL_WORKFLOW_PLUGIN_INFO_COPY1_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE MERGE_USER_LOG
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."MERGE_USER_LOG" ADD CONSTRAINT "MERGE_USER_LOG_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE MODEL_ACCESS_CONTROL
-- ----------------------------
CREATE INDEX "IDX_ACCESS_TIME" ON "KNOWLEDGE"."MODEL_ACCESS_CONTROL" USING BTREE (
  "ACCESS_TIME" "PG_CATALOG"."TIMESTAMP_OPS" ASC NULLS LAST
);
CREATE INDEX "IDX_EXPIREDTIME_STATUS" ON "KNOWLEDGE"."MODEL_ACCESS_CONTROL" USING BTREE (
  "EXPIRED_TIME" "PG_CATALOG"."TIMESTAMP_OPS" ASC NULLS LAST,
  "STATUS" "PG_CATALOG"."INT2_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE MODEL_ACCESS_CONTROL
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."MODEL_ACCESS_CONTROL" ADD CONSTRAINT "MODEL_ACCESS_MANAGE_COPY1_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE MODEL_ACCESS_MANAGE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."MODEL_ACCESS_MANAGE" ADD CONSTRAINT "MODEL_ACCESS_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE MODEL_ACCESS_STRATEGY
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."MODEL_ACCESS_STRATEGY" ADD CONSTRAINT "MODEL_ACCESS_STRATEGY_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE MODEL_ACCESS_STRATEGY_ITEMS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."MODEL_ACCESS_STRATEGY_ITEMS" ADD CONSTRAINT "MODEL_ACCESS_STRATEGY_ITEMS_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE MODEL_APPLICATION_REL
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."MODEL_APPLICATION_REL" ADD CONSTRAINT "MODEL_APPLICATION_REL_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE MODEL_ASSIGN
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."MODEL_ASSIGN" ADD CONSTRAINT "MODEL_ASSIGN_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE MODEL_ASSIGN_REL
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."MODEL_ASSIGN_REL" ADD CONSTRAINT "MODEL_ASSIGN_REL_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE MODEL_BASE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."MODEL_BASE" ADD CONSTRAINT "MODEL_TEMPLATE__COPY1_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE MODEL_ONLINE_APPLICATION
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."MODEL_ONLINE_APPLICATION" ADD CONSTRAINT "MODEL_APPLICATION_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE OPEN_APP_APPROVAL_PROGRESS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."OPEN_APP_APPROVAL_PROGRESS" ADD CONSTRAINT "OPEN_APP_APPROVAL_PROGRESS_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE OPEN_APP_COMPONENTS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."OPEN_APP_COMPONENTS" ADD CONSTRAINT "OPEN_APP_COMPONENTS_KEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE OPEN_APP_FILES
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."OPEN_APP_FILES" ADD CONSTRAINT "OPEN_APP_FILES_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE OPEN_APP_WHITE_LIST
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."OPEN_APP_WHITE_LIST" ADD CONSTRAINT "OPEN_APP_WHITE_LIST_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE OPEN_APPS
-- ----------------------------
CREATE UNIQUE INDEX "OPEN_APPS_KEY_IDX" ON "KNOWLEDGE"."OPEN_APPS" USING BTREE (
  "KEY" COLLATE "PG_CATALOG"."DEFAULT" "PG_CATALOG"."TEXT_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE OPEN_APPS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."OPEN_APPS" ADD CONSTRAINT "OPEN_APPS_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE PLATFORM_INFO
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."PLATFORM_INFO" ADD CONSTRAINT "PLATFORM_INFO_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE PLUGIN_APP_FIX_GUESS
-- ----------------------------
CREATE INDEX "PLUGIN_APP_FIX_GUESS_APP_ID_IDX" ON "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS" USING BTREE (
  "APP_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "INFO_TYPE" "PG_CATALOG"."INT4_OPS" ASC NULLS LAST,
  "GUESS_TYPE" "PG_CATALOG"."INT4_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE PLUGIN_APP_FIX_GUESS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS" ADD CONSTRAINT "PLUGIN_APP_FIX_GUESS_PK" PRIMARY KEY ("FIX_ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE PLUGIN_APP_FIX_GUESS_RELEASE
-- ----------------------------
CREATE INDEX "PLUGIN_APP_FIX_GUESS_RELEASE_IDX" ON "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS_RELEASE" USING BTREE (
  "APP_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "INFO_TYPE" "PG_CATALOG"."INT4_OPS" ASC NULLS LAST,
  "GUESS_TYPE" "PG_CATALOG"."INT4_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE PLUGIN_APP_FIX_GUESS_RELEASE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."PLUGIN_APP_FIX_GUESS_RELEASE" ADD CONSTRAINT "PLUGIN_APP_FIX_GUESS_RELEASE_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE PLUGIN_APP_RELEASE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."PLUGIN_APP_RELEASE" ADD CONSTRAINT "PLUGIN_APP_RELEASE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE PLUGIN_HEADER_RELEASE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."PLUGIN_HEADER_RELEASE" ADD CONSTRAINT "PLUGIN_HEADER_RELEASE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE PLUGIN_MACHINE_FIELD
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."PLUGIN_MACHINE_FIELD" ADD CONSTRAINT "PLUGIN_MACHINE_FIELD_PKEY" PRIMARY KEY ("MACHINE_FIELD_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE PLUGIN_MACHINE_FIELD_RELEASE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."PLUGIN_MACHINE_FIELD_RELEASE" ADD CONSTRAINT "PLUGIN_MACHINE_FIELD_RELEASE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE PLUGIN_MACHINE_RELEASE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."PLUGIN_MACHINE_RELEASE" ADD CONSTRAINT "PLUGIN_MACHINE_RELEASE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE PLUGIN_RPA
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."PLUGIN_RPA" ADD CONSTRAINT "PLUGIN_RPA_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE PROJECT
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."PROJECT" ADD CONSTRAINT "PK_PROJECT" PRIMARY KEY ("PROJECT_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE PROJECT_MEMBER
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."PROJECT_MEMBER" ADD CONSTRAINT "PK_PROJECT_MEMBER" PRIMARY KEY ("RELA_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE PROMPT_TEMPLATE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."PROMPT_TEMPLATE" ADD CONSTRAINT "PROMPT_TEMPLATE_PKEY" PRIMARY KEY ("TEMPLATE_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE RECENTLY_USED_APPS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."RECENTLY_USED_APPS" ADD CONSTRAINT "RECENTLY_USED_APPS_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE REL_PLATFORM
-- ----------------------------
CREATE INDEX "REL_PLATFORM_EXT_ID_BEFORE_INDEX" ON "KNOWLEDGE"."REL_PLATFORM" USING BTREE (
  "EXT_ID_BEFORE" COLLATE "PG_CATALOG"."DEFAULT" "PG_CATALOG"."TEXT_OPS" ASC NULLS LAST
);
CREATE INDEX "REL_PLATFORM_EXT_ID_INDEX" ON "KNOWLEDGE"."REL_PLATFORM" USING BTREE (
  "EXT_ID" COLLATE "PG_CATALOG"."DEFAULT" "PG_CATALOG"."TEXT_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE REL_PLATFORM
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."REL_PLATFORM" ADD CONSTRAINT "REL_PLATFORM_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE REL_PLATFORM_COPY
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."REL_PLATFORM_COPY" ADD CONSTRAINT "REL_PLATFORM_COPY1_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE REL_PLUGIN_APP
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."REL_PLUGIN_APP" ADD CONSTRAINT "REL_PLUGIN_APP_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE REL_PLUGIN_APP_RELEASE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."REL_PLUGIN_APP_RELEASE" ADD CONSTRAINT "REL_PLUGIN_APP_RELEASE_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE SEQUENCE
-- ----------------------------
CREATE UNIQUE INDEX "SEQUENCE_SEQUENCE_NAME_IDX" ON "KNOWLEDGE"."SEQUENCE" USING BTREE (
  "SEQUENCE_NAME" COLLATE "PG_CATALOG"."DEFAULT" "PG_CATALOG"."TEXT_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE SEQUENCE
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."SEQUENCE" ADD CONSTRAINT "SEQUENCE_PK" PRIMARY KEY ("SEQUENCE_ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE STAT_API_DAY
-- ----------------------------
CREATE INDEX "IDX_STATAPIDAY_APPID" ON "KNOWLEDGE"."STAT_API_DAY" USING BTREE (
  "APP_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);
CREATE UNIQUE INDEX "UID_STATAPIDAY_DAY_APPID" ON "KNOWLEDGE"."STAT_API_DAY" USING BTREE (
  "DAY" "PG_CATALOG"."TIMESTAMP_OPS" ASC NULLS LAST,
  "APP_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE STAT_API_DAY
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."STAT_API_DAY" ADD CONSTRAINT "STAT_CHAT_DAY_COPY1_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE STAT_API_DAY_20250915
-- ----------------------------
CREATE INDEX "STAT_API_DAY_20250915_APP_ID_IDX" ON "KNOWLEDGE"."STAT_API_DAY_20250915" USING BTREE (
  "APP_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);
CREATE UNIQUE INDEX "STAT_API_DAY_20250915_DAY_APP_ID_IDX" ON "KNOWLEDGE"."STAT_API_DAY_20250915" USING BTREE (
  "DAY" "PG_CATALOG"."TIMESTAMP_OPS" ASC NULLS LAST,
  "APP_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE STAT_API_DAY_20250915
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."STAT_API_DAY_20250915" ADD CONSTRAINT "STAT_API_DAY_20250915_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE STAT_CHAT_DAY
-- ----------------------------
CREATE INDEX "IDX_APPID" ON "KNOWLEDGE"."STAT_CHAT_DAY" USING BTREE (
  "APP_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);
CREATE UNIQUE INDEX "UID_DAY_APPID" ON "KNOWLEDGE"."STAT_CHAT_DAY" USING BTREE (
  "DAY" "PG_CATALOG"."TIMESTAMP_OPS" ASC NULLS LAST,
  "APP_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "PLATFORM_TYPE" "PG_CATALOG"."INT4_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE STAT_CHAT_DAY
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."STAT_CHAT_DAY" ADD CONSTRAINT "STAT_CHAT_DAY_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE STAT_TOKEN
-- ----------------------------
CREATE UNIQUE INDEX "UID_STATTOKEN" ON "KNOWLEDGE"."STAT_TOKEN" USING BTREE (
  "DAY" "PG_CATALOG"."TIMESTAMP_OPS" ASC NULLS LAST,
  "APP_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "PLATFORM_TYPE" "PG_CATALOG"."INT4_OPS" ASC NULLS LAST,
  "MODEL_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE STAT_TOKEN
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."STAT_TOKEN" ADD CONSTRAINT "STAT_CHAT_DAY_COPY1_PKEY1" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE STAT_TOKEN_20250915
-- ----------------------------
CREATE UNIQUE INDEX "STAT_TOKEN_20250915_DAY_APP_ID_PLATFORM_TYPE_MODEL_ID_IDX" ON "KNOWLEDGE"."STAT_TOKEN_20250915" USING BTREE (
  "DAY" "PG_CATALOG"."TIMESTAMP_OPS" ASC NULLS LAST,
  "APP_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "PLATFORM_TYPE" "PG_CATALOG"."INT4_OPS" ASC NULLS LAST,
  "MODEL_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE STAT_TOKEN_20250915
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."STAT_TOKEN_20250915" ADD CONSTRAINT "STAT_TOKEN_20250915_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- INDEXES STRUCTURE FOR TABLE STAT_USER
-- ----------------------------
CREATE UNIQUE INDEX "UID_STATTOKEN_COPY1" ON "KNOWLEDGE"."STAT_USER" USING BTREE (
  "DAY" "PG_CATALOG"."TIMESTAMP_OPS" ASC NULLS LAST,
  "APP_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST,
  "PLATFORM_TYPE" "PG_CATALOG"."INT4_OPS" ASC NULLS LAST,
  "USER_ID" "PG_CATALOG"."INT8_OPS" ASC NULLS LAST
);

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE STAT_USER
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."STAT_USER" ADD CONSTRAINT "STAT_TOKEN_COPY1_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE SYNONYMS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."SYNONYMS" ADD CONSTRAINT "SYNONYM_PK" PRIMARY KEY ("SYNONYM_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE TEAM_MEMBERS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."TEAM_MEMBERS" ADD CONSTRAINT "TEAM_MEMBERS_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE TEAMS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."TEAMS" ADD CONSTRAINT "TERMS_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE TERM_CATALOGS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."TERM_CATALOGS" ADD CONSTRAINT "TERM_CATALOGS_PKEY" PRIMARY KEY ("TERM_CATALOG_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE TERM_IMPORT
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."TERM_IMPORT" ADD CONSTRAINT "TERM_IMPORTS_PK" PRIMARY KEY ("TERM_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE TERM_SYNONYM_REF
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."TERM_SYNONYM_REF" ADD CONSTRAINT "TERM_SYNONYM_REF_PK" PRIMARY KEY ("TERM_ID", "SYNONYM_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE TERM_SYNONYM_REF_IMPORT
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."TERM_SYNONYM_REF_IMPORT" ADD CONSTRAINT "TERM_SYNONYM_REF_IMPORT_PK" PRIMARY KEY ("TERM_SYNONYM_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE TERM_TYPES
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."TERM_TYPES" ADD CONSTRAINT "TERM_TYPES_PK" PRIMARY KEY ("TERM_TYPE_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE TERMS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."TERMS" ADD CONSTRAINT "TERM_PK" PRIMARY KEY ("TERM_ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE USER_APPS_TOP
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."USER_APPS_TOP" ADD CONSTRAINT "USER_APPS_TOP_PKEY" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE USER_CONCURRENCY_CONFIG
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."USER_CONCURRENCY_CONFIG" ADD CONSTRAINT "USER_CONCURRENCY_CONFIG_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE USERS
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."USERS" ADD CONSTRAINT "USERS_PK" PRIMARY KEY ("ID");

-- ----------------------------
-- PRIMARY KEY STRUCTURE FOR TABLE USERS_20250604
-- ----------------------------
ALTER TABLE "KNOWLEDGE"."USERS_20250604" ADD CONSTRAINT "USERS_20250604_PK" PRIMARY KEY ("ID");
